Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Enable the production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
iamakulov committed Mar 19, 2018
1 parent 9c99566 commit c4fe999
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webpack.config.js
Expand Up @@ -18,7 +18,7 @@ const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
mode: 'development',
mode: isProduction ? 'production' : 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'public', 'build'),
Expand Down

1 comment on commit c4fe999

@iamakulov
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit enables the webpack’s production mode. Corresponding article section

The production mode is a preset of options which is optimized for building apps for production. In our case, it enabled minification, removes development-only code from your dependencies, and more.

Sizes
bundle.js went down from 1.25 MB to 387 kB.

Bundle difference
Here’s the bundle before and after the commit:

// bundle.js, before minification
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
// ...
// bundle.js, after minification
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})}, // ...

Please sign in to comment.