Webpack 5 Throws ModuleNotFoundError
See original GitHub issueHi, I’m using Webpack^5.46.0, @storybook/react^6.3.4, msw-storybook-addon^1.2.0, and msw^0.35.0. I have Storybook configured to use Webpack 5. Whenever the Storybook dev server is running and I modify the preview to initialize the worker, it works. But when I shutdown the server and restart it, it breaks with the following error:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it
This error is thrown multiple times for multiple packages. Has this been reported before? Any possible fix?
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Webpack 5 and Storybook 6 integration throws an error in ...
Basically the error is coming from the marked line in /node_modules/webpack/lib/DefinePlugin.js once running for the first time npm run ...
Read more >Webpack 5 errors | ImmutableX Documentation
The reason for this error is that create-react-app uses a version of webpack greater than 5, which, unlike versions < 5, does not...
Read more >webpack Module not found: Error: Can't resolve classNames ...
Coding example for the question webpack Module not found: Error: Can't resolve ... importing it to react application throws Module not found error...
Read more >module not found error | can not resolve react dom module
JS - JavaScript. module not found error | can not resolve react dom module. 12,501 views12K views. Mar 16, 2022. 29. Dislike. Share....
Read more >module not found error can't resolve 'fs' react js - You.com
Your quick fix is to take react scripts down to v4 until a fix for v5 is in place unless you are comfortable...
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 FreeTop 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
Top GitHub Comments
Went through the same thing just now… following the error traces. I tried this and it worked for me (looking for a better solution 😄 )
I followed the setup guide from storybook to support webpack 5
my deps look like this now:
Then in
.storybook/main.js
I have a custom webpackFinal setup to modify SB’s pollyfil configsNowadays setting up Storybook feels like performing surgery !
Hi, @ninjarogue. I believe I’ve replied to you in another thread. You have the mistake of missing
setupWorker
andsetupServer
in the same module. Those functions are meant for different environments and you cannot import them in a single module. Please split them by modules as shown in the examples and the issue will be gone.