Answers for "webpack env argument"

1

set env production webpack build

// webpack.config.js
module.exports = env => {
	const isProduction = env.NODE_ENV === 'production'
    // ...
    return {
      // ...
    }
}

// package.json
{
	...
    "scripts": {
    	"build": "webpack --env.NODE_ENV=production"
    },
    ...
}
Posted by: Guest on June-09-2020
0

webpack env argument

// webpack.config.js
    plugins: [
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV === 'production' ? 'production' : 'development')
        })
    ]
Posted by: Guest on December-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language