Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 928 Bytes

README.md

File metadata and controls

22 lines (14 loc) · 928 Bytes

The mode option

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.

Explain this example

Run package.json scripts:

"scripts": {
  "dev": "webpack --mode development",
  "prod": "webpack --mode production"
}

And inspect results dist/main.js bundle.

Notes

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.