Skip to content

Latest commit

 

History

History

mode

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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.