-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
It seems that NODE_ENV=development bundle exec rails assets:precompile ignores NODE_ENV environment variable.
In order to confirm the problem, I added simple debug code to config/webpack/production.js
+if (process.env.NODE_ENV === 'production') {
+ throw 'NODE_ENV: ' + process.env.NODE_ENV;
+}
process.env.NODE_ENV = process.env.NODE_ENV || 'production'And here is the result.
/Users/mito/work/webpacker-test% NODE_ENV=development bundle exec rails assets:precompile
yarn install v1.5.1
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 1.25s.
Webpacker is installed 🎉 🍰
Using /Users/mito/work/webpacker-test/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:
/Users/mito/work/webpacker-test/config/webpack/production.js:2
throw 'NODE_ENV: ' + process.env.NODE_ENV;
^
NODE_ENV: productionIn spite of NODE_ENV=development, process.env.NODE_ENV is production.
Probably, it's caused by this line https://github.com/rails/webpacker/blob/master/lib/tasks/webpacker/compile.rake#L24
This is a repository which includes the reproducing code.
https://github.com/y310/webpacker-test
Frozen-byte and hopewise