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