From Webpack 4 you can set mode
to tell webpack to use built in optimizations.
Setting mode
will expose process.env.NODE_ENV
environment variable which can be used to create different webpack configurations or in your app at compile time using DefinePlugin.
Run package.json scripts:
"scripts": {
"dev": "webpack --mode development",
"prod": "webpack --mode production"
}
And inspect results dist/main.js bundle.
If entry point is omitted your app files must go in src folder, when you run webpack a dist folder with all the output assets will be created.