-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Storybook with builder-webpac5 complains about conflicting values in DefinePlugin and not redefine custom variables #14257
Comments
I took a look at the repo:
The issue is that webpack4 is hoisted, but because you're using
I installed webpack5 at the root to force it to be hoisted:
However that leads to a different error. |
We are experiencing this issue as well, however it's hit and miss, sometimes it works sometimes it doesn't. Our project has to use Yarn dependency resolution for webpack 5, it may have something to do with that as some parts of storybook is still using webpack 4. |
I also experience the issue
With
and the conflict resolution
But the storybook seems to work even with this warning |
I have the same issue as well, Storybook works nonetheless, but the live reload is not working when doing edits to components. I need to manually refresh the Storybook webpage in order to see my changes. |
we are running into this issue as well when using yarn resolutions for webpack 5 in our workspaces monorepo |
Is this because of:
According to the Webpack docs, one should avoid overriding upper-level portions of process: https://webpack.js.org/plugins/define-plugin/. |
same problem |
Hey guys, Like this: config.plugins = [
...config.plugins.filter((plugin) => !plugin.definitions),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(
configType === "DEVELOPMENT" ? "development" : "production"
),
"process.env.NODE_PATH": JSON.stringify([]),
"process.env.STORYBOOK": JSON.stringify('true'),
"process.env.PUBLIC_PATH": JSON.stringify("."),
})
]; 💪 |
@rbatsenko suggestion doesn't work if you run |
@ritchieanesco interesting 🤔 I don't have time to investigate now, maybe you can try to ask Webpack guys |
Thought i'd document more of my findings... the warning goes away once the build is cached when running The warning still appears when you run package.json |
Try upgrading to the latest prerelease:
Does that fix it? |
I just experienced this error with beta 10. |
@gertsonderby did you try installing webpack5 as a project dev dependency? |
still present in beta.10 even with webpack 5.x in dev dependencies. when running adding does however have slight effect
with it
without it
|
I'm working with the prereleases specifically because we use Webpack 5. |
@gertsonderby not all projects that use webpack5 have webpack as a direct project dependency. sometimes it's hidden beneath NextJS/Angular/etc. indirectly and NPM/Yarn hoisting can mess things up. having it as a project dep forces webpack5 to be hoisted. If it's not hoisted properly, this DefinePlugin error shows up. |
Fair enough, and apologies if I came off snippy. And to clarify, webpack is a direct dependency in the projects I've seen this happen in. |
@gertsonderby i'm on v6.3.0-beta.10 and still getting the warning. |
@shilman the error is now gone for me, thank you very much :) Are you planing on patching this back to 6.3? |
@stefan-schweiger yup, will patch back in a day or two! |
@shilman the warning is gone for me as well. One of the other issues, mentioned by someone else in this ticket, was about the hot update not working. That's the issue that is really what we were hoping to get fixed. We thought the warning could maybe be related but it sounds like it isn't? |
@WalterWeidner for me the hot reload is working fine now again with |
I just removed my node_modules/ folder so there shouldn't be a cache problem, reinstalled, and ran These are what I have configured as dev dependencies currently:
I'm curious if any of them stand out to you as important diferences @stefan-schweiger |
@WalterWeidner since I'm using storybook with angular, all of them stand out for me 😅 |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.1 containing PR #15365 that references this issue. Upgrade today to the
|
Thanks! Looks good to me |
was still getting error message but ran once with |
We do not have a .env file, we are having an issue with process not being defined. Some of them are inconsistent with |
We're seeing this error with |
i have updated repository with demo story, there is no warnings in console, but DefinePlugin not working( in demo there is error: "window.FAKE_GLOBAL_FUNCTION is not a function") |
i found that this line not replacing with DefinePlugin:
but this one:
will be compiled to:
|
Seeing this error with Storybook 6.3.7. I'm using node 14.17.0 |
I still see this warning with Storybook 6.3.8. (node 14.17.6) |
confirming for 6.3.10 and 6.3.12 |
Hi all, I'm facing the same issue with "@storybook/react": "^6.4.9, any way to solve this? |
@cosmin-dev if you are talking about that defining value not working:
so i have fixed in my storybook it by moving this code to |
hi @khats thanks for the quick response, I'm talking about this issue Also the build is stuck at 99% |
Hi, any update regarding this issue? |
Storybook I'm seeing this warning as well, but SB seems to run fine. WARNING in DefinePlugin
Conflicting values for 'process.env.NODE_ENV'
1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
manager (webpack 5.74.0) compiled with 2 warnings in 88502 ms
|
I am running into this error with a CRA app with storyobook 6.5.16 |
Storybook 6.5.16 % yarn why webpack
yarn why v1.22.19
[1/4] 🤔 Why do we have the module "webpack"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "webpack"
info Reasons this module exists
- Hoisted from "@storybook#addon-essentials#@storybook#core-common#webpack"
- Hoisted from "@storybook#angular#@storybook#core#@storybook#core-server#webpack"
- Hoisted from "@storybook#angular#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#webpack"
- Hoisted from "@storybook#angular#@storybook#core#@storybook#core-server#@storybook#manager-webpack4#webpack"
info Disk size without dependencies: "6.21MB"
info Disk size with unique dependencies: "17.99MB"
info Disk size with transitive dependencies: "38.2MB"
info Number of shared dependencies: 107
=> Found "@angular-devkit/build-angular#[email protected]"
info This module exists because "@angular-devkit#build-angular" depends on it.
=> Found "@storybook/angular#[email protected]"
info This module exists because "@storybook#angular" depends on it.
info Disk size without dependencies: "6.22MB"
info Disk size with unique dependencies: "16.13MB"
info Disk size with transitive dependencies: "33.01MB"
info Number of shared dependencies: 69
=> Found "@storybook/builder-webpack5#[email protected]"
info This module exists because "@storybook#builder-webpack5" depends on it.
info Disk size without dependencies: "6.17MB"
info Disk size with unique dependencies: "16.07MB"
info Disk size with transitive dependencies: "32.96MB"
info Number of shared dependencies: 69
=> Found "@storybook/manager-webpack5#[email protected]"
info This module exists because "@storybook#manager-webpack5" depends on it.
info Disk size without dependencies: "5.94MB"
info Disk size with unique dependencies: "15.84MB"
info Disk size with transitive dependencies: "32.73MB"
info Number of shared dependencies: 69
✨ Done in 0.87s. I also tried yarn add webpack@5 --dev |
Describe the bug
I am using Storybook6-rc01 with builder-webpack5.
I define several variables with patching webpack config and DefinePlugin through function
webpackFinal
:Function
FAKE_GLOBAL_FUNCTION
call is added to test storyBut there is error about
Conflicting values for 'process.env'
in build console and there is error on rendered story on UI aboutwindow.FAKE_GLOBAL_FUNCTION
is not definedTo Reproduce
Steps to reproduce the behavior:
yarn
yarn start-storybook
Expected behavior
Conflicting values for 'process.env' '{NODE_ENV: "development", NODE_PATH: [], STORYBOOK: "true", PUBLIC_URL: "."}' !== '{}'
Screenshots
Code snippets
If applicable, add code samples to help explain your problem.
System
Environment Info:
System:
OS: macOS 11.0.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
Yarn: 2.4.0 - /usr/local/bin/yarn
npm: 6.14.9 - ~/.nvm/versions/node/v14.15.3/bin/npm
Browsers:
Chrome: 89.0.4389.90
Firefox: 76.0.1
Safari: 14.0.1
Additional context
Add any other context about the problem here.
┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: