Skip to content
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

Custom DefinePlugin being ignored #726

Closed
renancouto opened this issue Dec 5, 2017 · 1 comment
Closed

Custom DefinePlugin being ignored #726

renancouto opened this issue Dec 5, 2017 · 1 comment
Labels
Milestone

Comments

@renancouto
Copy link
Contributor

I am trying to pass some env vars to my components using webpack's DefinePlugin, but I keep getting only { NODE_ENV: 'development' } on process.env.

I forked the example repo, as an example. This is my setup: https://github.com/renancouto/example/commit/980967e7df67aaa0c26423a604c521f240586313

@sapegin
Copy link
Member

sapegin commented Dec 6, 2017

That’s the reason:

When defining values for process prefer 'process.env.NODE_ENV': JSON.stringify('production') over process: { env: { NODE_ENV: JSON.stringify('production') } }. Using the latter will overwrite the process object which can break compatibility with some modules that expect other values on the process object to be defined.

new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
STYLEGUIDIST_ENV: JSON.stringify(env),
},
}),

@sapegin sapegin added the bug label Dec 6, 2017
@sapegin sapegin added this to the 6.1.0 milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants