-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Description
- [x ] bug report
- What is the current behavior?
helpers.isWebpackDevServer always returns false (when used inside webpack config for anything other than src/index.html page).
To test, add the following line to webpack.common.js then run "npm run server:dev" and then "npm run build:dev" to watch the output.
console.log('DEBUG: helpers.isWebpackDevServer() = ' + helpers.isWebpackDevServer());
I presume it's intended for use by the HtmlWebpackPlugin and the src/index.html page, but if you want to use it elsewhere it breaks. As it's quite a handy function, I am also using it for setting a few other conditional variables inside my webpack config.
- What is the expected behavior?
- Expected helpers.isWebpackDevServer() to return TRUE when running "npm run server:dev"
- Expected helpers.isWebpackDevServer() to return FALSE when running "npm run build:dev"
- Please tell us about your environment:
Windows 10, command line. - Possible solution:
Why not do a simple indexOf? e.g.
function isWebpackDevServer() {
var returnValue = false;
if (process.argv.length > 1)
returnValue = (process.argv[1].toLowerCase().indexOf('webpack-dev-server') != -1);
return returnValue;
}
I might be missing something, but this seems to cover all bases
Igonato, sumigoma and rzubov
Metadata
Metadata
Assignees
Labels
No labels