Compress distributed files
This commit is contained in:
parent
f90fd688bf
commit
bbc70a004d
2 changed files with 9 additions and 0 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"babel-loader": "^7.0.0",
|
||||
"babel-plugin-transform-react-jsx": "^6.24.1",
|
||||
"babel-preset-env": "^1.5.2",
|
||||
"compression-webpack-plugin": "~1.0.0",
|
||||
"copy-webpack-plugin": "~3.0.1",
|
||||
"eslint": "^3.0.0",
|
||||
"eslint-loader": "~1.6.1",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ const path = require("path");
|
|||
const copy = require("copy-webpack-plugin");
|
||||
const fs = require("fs");
|
||||
const webpack = require("webpack");
|
||||
const CompressionPlugin = require("compression-webpack-plugin");
|
||||
|
||||
var externals = {
|
||||
"cockpit": "cockpit",
|
||||
|
|
@ -96,6 +97,13 @@ if (production) {
|
|||
|
||||
/* Rename output files when minimizing */
|
||||
output.filename = "[name].min.js";
|
||||
|
||||
plugins.unshift(new CompressionPlugin({
|
||||
asset: "[path].gz[query]",
|
||||
test: /\.(js|html)$/,
|
||||
minRatio: 0.9,
|
||||
deleteOriginalAssets: true
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue