Add compression pluggin

This commit is contained in:
Paulo Gustavo Veiga 2021-12-21 20:38:13 -08:00
parent 549dfed708
commit b29b75931e
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@wisemapping/mindplot", "name": "@wisemapping/mindplot",
"version": "0.4.0", "version": "0.4.1",
"description": "WiseMapping - Mindplot Canvas Library", "description": "WiseMapping - Mindplot Canvas Library",
"homepage": "http://www.wisemapping.org/", "homepage": "http://www.wisemapping.org/",
"main": "dist/main.js", "main": "dist/main.js",
@ -42,6 +42,7 @@
"@babel/register": "^7.16.0", "@babel/register": "^7.16.0",
"babel-loader": "^8.2.2", "babel-loader": "^8.2.2",
"clean-webpack-plugin": "^4.0.0-alpha.0", "clean-webpack-plugin": "^4.0.0-alpha.0",
"compression-webpack-plugin": "^9.2.0",
"copy-webpack-plugin": "^10.0.0", "copy-webpack-plugin": "^10.0.0",
"core-js": "^3.15.2", "core-js": "^3.15.2",
"cypress": "^8.4.1", "cypress": "^8.4.1",

View File

@ -1,15 +1,22 @@
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const CompressionPlugin = require('compression-webpack-plugin');
const common = require('./webpack.common'); const common = require('./webpack.common');
const prodConfig = { const prodConfig = {
mode: 'production', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
optimization: { optimization: {
minimize: true,
splitChunks: { splitChunks: {
chunks: 'all', chunks: 'all',
minSize: 2000000, minSize: 2000000,
}, },
}, },
plugins: [
new CompressionPlugin({
test: /\.js(\?.*)?$/i
}),
],
}; };
module.exports = merge(common, prodConfig); module.exports = merge(common, prodConfig);