NODE_ENV=test causes DefinePlugin warnings? #859
jdelStrother
started this conversation in
General
Replies: 1 comment
-
|
@jdelStrother please comment on #864. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I compile my assets with Shakapacker/webpack in my test environment (RAILS_ENV=test), I get the following warning:
Shakapacker is defaulting ENV["NODE_ENV"]=test from here, which ends up in DefinePlugin via Webpack's EnvironmentPlugin.
Webpack defaults
options.optimization.nodeEnvto development here (because options.mode=development), which ends up in a second DefinePlugin hereI'm not totally sure what the correct fix might be. For my purposes I'd be happy if NODE_ENV was only ever development/production (ie RAILS_ENV=test would result in NODE_ENV=development), but I can see that might not fit all use cases. For now I can get around it by making sure my test environment always sets NODE_ENV=development before invoking Shakapacker.
If shakapacker wants to explicitly set
ENV["NODE_ENV"], I wonder if it ought to setoptimization.nodeEnv=false(ref) to avoid the conflicting DefinePlugin values.Or maybe we could set
node_envto a preferred value within each environment in shakapacker.yml ?Possibly related: #337
Beta Was this translation helpful? Give feedback.
All reactions