Storybook with builder-webpac5 complains about conflicting values in DefinePlugin and not redefine custom variables
See original GitHub issueDescribe the bug
I am using Storybook6-rc01 with builder-webpack5.
I define several variables with patching webpack config and DefinePlugin through function webpackFinal
:
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("development"),
"window.FAKE_GLOBAL_FUNCTION": "(function() { return false; })",
}),
],
Function FAKE_GLOBAL_FUNCTION
call is added to test story
But there is error about Conflicting values for 'process.env'
in build console and there is error on rendered story on UI about window.FAKE_GLOBAL_FUNCTION
is not defined
To Reproduce Steps to reproduce the behavior:
- Go to https://github.com/khats/storybook-demo
- Pull project
- Install dependencies with
yarn
- Start storybook with
yarn start-storybook
Expected behavior
- No error in build console:
Conflicting values for 'process.env' '{NODE_ENV: "development", NODE_PATH: [], STORYBOOK: "true", PUBLIC_URL: "."}' !== '{}'
- window. FAKE_GLOBAL_FUNCTION is defined and story is rendered without error
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® Core™ 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:19
- Comments:59 (13 by maintainers)
Hi, any update regarding this issue? Storybook version:
6.5.9
I am using Angular 13 with@storybook/angular
and@storybook/builder-webpack5
without any manually added plugin, but how should I fix it? Thanks.Still seeing “Conflicting values for process.env” 😞 . Upgraded from 6.2.9 to 6.3.4: