webpack 4 -> 5 : several typescript issues
See original GitHub issueBug report
webpack version: beta 15 Node.js version: 10.xxx Operating System: windows
1. ModuleOptions is not exported
2. ResolveOptions is not exported
fix:
export them at the end of the file 
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:
- Created 3 years ago
- Reactions:2
- Comments:21 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m happy that webpack 5 has its own generated types.
However I used these types from webpack (back when using
@types/webpack4), how to make this work with webpack 5 beta 15? All these types are now missing when installing the new package:@evilebottnawi
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.