Rails webpacker for some reason always thinks that NODE_ENV is a product, despite the fact that I use `webpack-dev-server` and set NODE_ENV for development

As a name, I use the docker ruby ​​2.3.5 (ubuntu) environment, even though I already have NODE_ENV = development installed, when I try to intercept the value of process.env.NODE_ENV , I still see the production, which I can not find somewhere it has been redefined. This only happens in the docker environment, but not on my MacOS, not sure what the reason is?

Update: here's Dockerfile and docker-compose.yml for reference: https://gist.github.com/goodwill/b4e677ccf8fe0079183adeec35218812

Update. This is the error I encountered while starting the webpacker-dev server:

 04:08:37 webpacker.1 | /app/config/webpack/development.js:20 04:08:37 webpacker.1 | https: settings.dev_server.https, 04:08:37 webpacker.1 | ^ 04:08:37 webpacker.1 | 04:08:37 webpacker.1 | TypeError: Cannot read property 'https' of undefined 04:08:37 webpacker.1 | at Object.<anonymous> (/app/config/webpack/development.js:20:31) 04:08:37 webpacker.1 | at Module._compile (module.js:570:32) 04:08:37 webpacker.1 | at Object.Module._extensions..js (module.js:579:10) 04:08:37 webpacker.1 | at Module.load (module.js:487:32) 04:08:37 webpacker.1 | at tryModuleLoad (module.js:446:12) 04:08:37 webpacker.1 | at Function.Module._load (module.js:438:3) 04:08:37 webpacker.1 | at Module.require (module.js:497:17) 04:08:37 webpacker.1 | at require (internal/module.js:20:19) 04:08:37 webpacker.1 | at requireConfig (/app/node_modules/webpack/bin/convert-argv.js:97:18) 04:08:37 webpacker.1 | at /app/node_modules/webpack/bin/convert-argv.js:104:17 
+5
source share
1 answer

Docker containers will not collect environment variables from your local environment.

Set the environment variable inside the Docker file. For instance:

 ENV NODE_ENV=development 

Alternatively, you can start the container with this environment variable from the command line:

 $ docker run -e NODE_ENV=devlopment mycontainer 
+3
source

Source: https://habr.com/ru/post/1274262/


All Articles