Skip to content
Snippets Groups Projects
webpack.config.prod.js 737 B
Newer Older
Hermann's avatar
Hermann committed
const webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');

// Start with dev config
const config = require('./webpack.config.js');

// Remove development server and code map
config.devServer = undefined;
config.devtool = '';

// Add optimization plugins
config.plugins = [
  new webpack.optimize.UglifyJsPlugin(),
  new webpack.optimize.AggressiveMergingPlugin(),
  new CompressionPlugin({
    asset: '[path].gz[query]',
    algorithm: 'gzip',
    test: /\.js$|\.css$|\.html$/,
    threshold: 10240,
    minRatio: 0.8,
  }),
];

// Replace development with production config
config.resolve.alias.config = `${__dirname}/config.${process.env.BUILD_CONFIG_POSTFIX}.js`;


Hermann's avatar
Hermann committed
module.exports = config;