question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack 4 -> 5 : several typescript issues

See original GitHub issue

Bug report

webpack version: beta 15 Node.js version: 10.xxx Operating System: windows

1. ModuleOptions is not exported

2. ResolveOptions is not exported

image fix: export them at the end of the file image

3. EntryObject is wrong

type Entry =
	| string
	| (() => string | EntryObject | [string, string] | Promise<EntryStatic>)
	| EntryObject
	| [string, string];
declare interface EntryObject {
	[index: string]: string | [string, string] | EntryDescription;
}

but doc says here : https://webpack.js.org/configuration/entry-context/#dependencies

module.exports = {
  //...
  entry: {
    app: { import: './app.js', dependOn: 'react-vendors' },
    'react-vendors': ['react', 'react-dom', 'prop-types']
  }
};

which triggers a typescript error there should be some | string[] somewhere

4. no migration Guide

(bug found in some code I maintain) - ... extends CompilationHooks -> ... extends CompilationHooksJavascriptModulesPlugin - compilation.Chunk->Chunk - compilation.Compilation->Compilation - Module -> ModuleOptions - Resolve -> ResolveOptions

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
ryaneliancommented, Apr 23, 2020

I’m happy that webpack 5 has its own generated types.

However I used these types from webpack (back when using @types/webpack 4), how to make this work with webpack 5 beta 15? All these types are now missing when installing the new package:

import webpack = require('webpack');

webpack.RuleSetRule

webpack.RuleSetLoader

webpack.Plugin

webpack.Output

webpack.Resolve

webpack.Options.Optimization

webpack.Stats.ToJsonOutput

webpack.loader.LoaderContext
3reactions
artem-malkocommented, May 2, 2020

@evilebottnawi

What is missing in master?

I’ve not found Loader type and LoaderContext. So, it’s quite difficult to write own loader with typescript using webpack beta 15 right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >
Upgrading Webpack 4 → 5 | Square Corner Blog
It supports multiple locales by default, is typed, and has a few niceties such as warning on unused strings and the ability to...
Read more >
Integrating TypeScript with Webpack | by Uday Hiwarale
For example, you can combine multiple JavaScript files together to produce ... However, Webpack solves these issues by replacing import and ...
Read more >
Compiling and bundling TypeScript libraries with Webpack
It's important to keep in mind a few practices when developing a library in TypeScript in order to provide the best support for...
Read more >
fork-ts-checker-webpack-plugin - npm
Issues options. Options for the issues filtering ( issue option object). I could write some plain text explanation of these options but I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found