Skip to content

Instantly share code, notes, and snippets.

@jonluca
Last active March 20, 2018 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonluca/1760ab0dca958f62e316b1516eb5c481 to your computer and use it in GitHub Desktop.
Save jonluca/1760ab0dca958f62e316b1516eb5c481 to your computer and use it in GitHub Desktop.
Webpack Config
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ZopfliPlugin = require("zopfli-webpack-plugin");
module.exports = {
entry: './js/app.js',
mode: 'production',
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
module: {
rules: [{
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
}, {
test: /(fonts|images)/,
loaders: ['url-loader']
}]
},
plugins: [new UglifyJsPlugin({
test: /\.js($|\?)/i
}), new ZopfliPlugin({
asset: "[path].gz[query]",
algorithm: "zopfli",
test: /\.(js|html)$/,
threshold: 10240,
minRatio: 0.8
})]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment