I\'m trying to convert an angular app from gulp to webpack. in gulp I use gulp-preprocess to replace some variables in the html page (e.g. database name) depending on the NO
You can pass any command-line argument without additional plugins using --env since webpack 2:
--env
webpack --config webpack.config.js --env.foo=bar
Using the variable in webpack.config.js:
module.exports = function(env) { if (env.foo === 'bar') { // do something } }
Source