Below is the setup in my vue-cli3 configuration file:
vue.config.js:
const path = require('path')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();
module.exports = {
publicPath: './',
lintOnSave: true,
chainWebpack(config) {
config.devServer
.port(8089)
.open(true)
.disableHostCheck(true)
config.when(process.env.NODE_ENV !== 'development', config => {
config
.plugin('gzip')
.use(CompressionWebpackPlugin, [{
algorithm: 'gzip',
test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
threshold: 8192,
minRatio: 0.8,
cache: true
}])
})
}
}
In the speed-measure-webpack-plugin configuration, all plugins are wrapped, however, if you use webpack-chain, can you achieve the same without using this plugin?