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.

Typeissue with Webpack v4 (Cannot find module 'webpack5' or its corresponding type declarations)

See original GitHub issue

We’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:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
privatenumbercommented, Dec 15, 2020

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

1reaction
deleoniocommented, Dec 15, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

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