Typeissue with Webpack v4 (Cannot find module 'webpack5' or its corresponding type declarations)
See original GitHub issueWe’re using Webpack v4 in our projekt. Now our typecheck fails with:
$ tsc --noEmit
node_modules/esbuild-loader/dist/minify-plugin.d.ts(3,27): error TS2307: Cannot find module 'webpack5' or its corresponding type declarations.
error Command failed with exit code 2.
Might be related to this: https://github.com/privatenumber/esbuild-loader/blob/develop/src/minify-plugin.ts#L5-L6
This loader seems to solve it with this: https://github.com/privatenumber/esbuild-loader/blob/develop/package.json#L58
I guess we could also install webpack v5. But only to fix typings this seems a bit weird. You have any ideas how this could be solved or changed? If you can point to the right direction I’m happy to provide a PR.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
node.js - Error: Cannot find module 'webpack'
Works just fine for me on Windows 10: setx NODE_PATH %AppData%\npm\node_modules . You might need to restart your cmd before the NODE_PATH variable...
Read more >Storybook build fails with "Cannot find module 'webpack/lib ...
I'll try adding webpack 5 as a project dependency as well at that time and report back (weird that apparently the chromatic build...
Read more >How to fix Error: cannot find module "webpack"
The Cannot find module webpack occurs when webpack is not globally installed. It is a problem with the npm script or application. You...
Read more >To v5 from v4
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 >webpack-dev-server
Getting Started. First things first, install the module: npm install webpack-dev-server --save-dev. or.
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
Fixed for Webpack 4 in v2.6.3 via https://github.com/privatenumber/esbuild-loader/pull/78
LMK if anyone has ideas on how to interop with Webpack v5 as well
Esbuild-loader is a webpack extension.
Webpack can not be a dependency of esbuild-loader.
Webpack must be a devDep and peerDep of esbuild-loader.
Prease remove webpack from the deps.