Compress distributed files
This commit is contained in:
parent
23f2f16715
commit
26a7c0154c
2 changed files with 9 additions and 0 deletions
|
|
@ -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