You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The WEBPACK_DEV_SERVER environment variable is not set when running "webpack serve" #2781
Put the above in a webpack.config.js executed via:
webpack serve
Expected Behavior
I would expect the console.log to print true or 1. I am not sure what used to be the value for this environment variable but I am sure it used to be there.
Actual Behavior
undefined is printed.
How can we reproduce the behavior?
Simply place the above console.log inside any webpack.config.js that is run via webpack serve.
WEBPACK_DEV_SERVER only for custom running, no WEBPACK_DEV_SERVER in webpack.config.js, because we can't know about it, you can use multi compiler mode, you can use env variables for this
Well it used to work when running webpack-dev-server directly so why doesn't it work with webpack serve? After upgrading to webpack 5 I had to change to webpack serve because webpack-dev-server didn't work anymore due to this issue: #2029 (comment).
If this was expected behavior with the transition to webpack 5 then I would at least expect this to be documented in the migration guide instead of closing this issue as if was meant to be obvious that this is not possible...
Activity
alexander-akait commentedon Oct 19, 2020
WEBPACK_DEV_SERVERonly for custom running, noWEBPACK_DEV_SERVERinwebpack.config.js, because we can't know about it, you can use multi compiler mode, you can use env variables for thisbensampaio commentedon Oct 20, 2020
Well it used to work when running
webpack-dev-serverdirectly so why doesn't it work withwebpack serve? After upgrading to webpack 5 I had to change towebpack servebecausewebpack-dev-serverdidn't work anymore due to this issue: #2029 (comment).If this was expected behavior with the transition to webpack 5 then I would at least expect this to be documented in the migration guide instead of closing this issue as if was meant to be obvious that this is not possible...
alexander-akait commentedon Oct 20, 2020
@bensampaio can you provide real use case, maybe we should restore this behavior, it will be easy
bensampaio commentedon Oct 20, 2020
@evilebottnawi would this help: https://github.com/bensampaio/dev-server-issue ?
alexander-akait commentedon Oct 20, 2020
@bensampaio I recommend to use
--envflags for this, but we can return this behavior, but this need to be fixed in webpack-clibensampaio commentedon Oct 21, 2020
@evilebottnawi should I then open a new issue in webpack-cli?
alexander-akait commentedon Oct 21, 2020
@bensampaio yep please