Add webpack compression plugin.

This commit is contained in:
projectmoon 2021-01-24 14:40:34 +00:00
parent fe19a98829
commit 26f8adcd4e
3 changed files with 66 additions and 53 deletions

10
package-lock.json generated
View File

@ -1128,6 +1128,16 @@
} }
} }
}, },
"compression-webpack-plugin": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-7.1.2.tgz",
"integrity": "sha512-9DKNW6ILLjx+bNBoviHDgLx6swBhWWH9ApClC9sTH2NoFfQM47BapQfovCm9zjD9v1uZwInF5a925FB9ErGQeQ==",
"dev": true,
"requires": {
"schema-utils": "^3.0.0",
"serialize-javascript": "^5.0.1"
}
},
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",

View File

@ -22,6 +22,7 @@
"devDependencies": { "devDependencies": {
"@types/google-protobuf": "^3.7.4", "@types/google-protobuf": "^3.7.4",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^7.1.2",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^4.5.0",
"ts-loader": "^8.0.13", "ts-loader": "^8.0.13",
"ts-protoc-gen": "^0.14.0", "ts-protoc-gen": "^0.14.0",

View File

@ -1,5 +1,6 @@
const webpack = require('webpack'); const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path'); const path = require('path');
@ -53,6 +54,7 @@ module.exports = {
cleanAfterEveryBuildPatterns: ['!templates/**/*'], cleanAfterEveryBuildPatterns: ['!templates/**/*'],
dry: false dry: false
}), }),
new CompressionPlugin(),
packPage('login.html.tera'), packPage('login.html.tera'),
packPage('base.html.tera'), packPage('base.html.tera'),
packPage('error.html.tera'), packPage('error.html.tera'),