-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack.IgnorePlugin() Error with Webpack 5 and React < 18 #18571
Comments
I'm having the same issue |
I’m similarly using React 16 with Storybook v6.5 and Webpack 5, and didn’t run into this. I tried to reproduce the above setup , I think the dependencies & config are identical (package.json, main.js). This error message looks a bit like what would happen if using a Webpack 4 plugin with Webpack 5, or vice-versa – perhaps your project still has Webpack 4 getting loaded somehwere? |
It works fine with React 16, but I get this error after updating to React 17. |
I'm using React 17 with webpack 5 but encountered this error when trying to upgrade storybook from 6.4.9 to 6.5.9. |
@ShuPink This solution seems to be working as a temporary fix. |
My problem temporarily has been solved by using |
Does anybody have a reproduction repo they can share? See how to create a repro. Thank you! 🙏 |
Upgrading to 6.5.10 has now resolved this issue for me ^^;
|
I still have the same issue with Storybook 6.5.10. I haven't found a chance to create a repo yet. I will do this next week |
We are also having this issue.
|
@shilman here's a repo with a (excessively?) minimal reproduction https://github.com/hrldcpr/storybook-waterfall-bailing-error Run I think the particular locked package versions definitely have something to do with things, but this is pulled from a large somewhat-messy proprietary codebase so this is the best I could do |
@hrldcpr Thanks so much! I'll see what we can figure out! Cc @storybookjs/core |
@hrldcpr repro demonstrates the problem (in both npm8 and npm6), thanks so much Haven't figured out the issue yet, but have some workarounds:
|
Ah yeah good point, I think Similarly, Unfortunately, neither of these are easy options for the larger project where we're experiencing the error, so if anyone can find a less invasive fix/workaround, that would be awesome. Edit: oh somehow missed the npm |
That And it leads me to think that the issue is that both webpack 4 and 5 are in the project, for some reason… the relevant lines in {
...
"packages": {
...
"node_modules/@storybook/builder-webpack5/node_modules/@storybook/core-common/node_modules/webpack": {
"version": "4.46.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
...
"node_modules/@storybook/manager-webpack5/node_modules/@storybook/core-common/node_modules/webpack": {
"version": "4.46.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
...
"node_modules/@storybook/react/node_modules/webpack": {
"version": "4.46.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
...
"node_modules/@storybook/telemetry/node_modules/webpack": {
"version": "4.46.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz",
... I know very little about package-lock.json so I don't know how those got in there, but if there's some clever npm command to update them to webpack 5 then it could maybe be a cleaner fix than needing to add the |
At least with core-common it explicitly defines that it uses webpack 4: I feel like this should be changed to "^4.0.0 || ^5.0.0" to allow either version. But I think that the default would be to install webpack 5 which would break the build of people not using the webpack 5 builder. So the overrides option may be the best bet if you can use npm v8. Unfortunately my team is stuck on npm v7 & I attempted modifying the package-lock by hand to get rid of webpack 4 references but that proved to be more difficult than I hoped so I'm just going to hold back on upgrading to 6.5. Hopefully v7 will switch to webpack 5 by default |
I am getting the same issue with the latest build as well pacakge.json: |
@rexkenley just in case you didn't see it above, if you're looking for a workaround before this gets fixed, try adding this to your
|
That didn't work. Do I have to run |
@rexkenley not sure, sorry. the |
You are right. The issue was I copied the version verbatim, I should have replaced the version with the one that I am using. The workaround WORKS. Thanks for your help! |
Describe the bug
Tried updating the webpack from 4 to 5 but still have to use React 16.14.0. Added both
@storybook/builder-webpack5
and@storybook/manager-webpack5
but getting an error from webpack because of howframework-preset-react-dom-hack.js
is usingwebpack.IgnorePlugin()
.Error:
To Reproduce
Set the package as below:
and here is the
main.js
file:System
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Browsers:
Chrome: 97.0.4692.99
Firefox: 101.0
Safari: 15.5
npmPackages:
@storybook/addon-a11y: ^6.5.9 => 6.5.9
@storybook/addon-actions: ^6.5.9 => 6.5.9
@storybook/addon-essentials: ^6.5.9 => 6.5.9
@storybook/addon-interactions: ^6.5.9 => 6.5.9
@storybook/addon-links: ^6.5.9 => 6.5.9
@storybook/builder-webpack5: ^6.5.9 => 6.5.9
@storybook/manager-webpack5: ^6.5.9 => 6.5.9
@storybook/react: ^6.5.9 => 6.5.9
@storybook/testing-library: ^0.0.13 => 0.0.13
Additional context
Looks like the error comes from
framework-preset-react-dom-hack.js
:The text was updated successfully, but these errors were encountered: