Skip to content

Instantly share code, notes, and snippets.

@rcdexta
Created January 15, 2017 12:14
Show Gist options
  • Save rcdexta/133a7999f0b7609f7fc9136c50ce185d to your computer and use it in GitHub Desktop.
Save rcdexta/133a7999f0b7609f7fc9136c50ce185d to your computer and use it in GitHub Desktop.
...
var CompressionPlugin = require("compression-webpack-plugin");
...
let config = {
entry: path.join(__dirname, '../app/index'),
cache: false,
devtool: 'cheap-module-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: {
warnings: false, // Suppress uglification warnings
pure_getters: true,
unsafe: true,
unsafe_comps: true,
screw_ie8: true
},
output: {
comments: false,
},
exclude: [/\.min\.js$/gi] // skip pre-minified libs
}),
new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]),
new webpack.NoErrorsPlugin(),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0
})
...
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment