【更新】解决加载首页loading慢的问题,更多配置参见文档(https://doc.xiaonuo.vip)

pull/24/head
小诺 2021-08-13 20:17:36 +08:00 committed by 小诺
parent 746dd25063
commit eb166b58c1
2 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,7 @@
"axios": "^0.19.0",
"babel-polyfill": "^6.26.0",
"clipboard": "^2.0.6",
"compression-webpack-plugin": "5.0.1",
"core-js": "^3.1.2",
"crypto-js": "^4.0.0",
"default-passive-events": "^1.0.10",

View File

@ -1,6 +1,8 @@
const path = require('path')
const webpack = require('webpack')
const createThemeColorReplacerPlugin = require('./config/plugin.config')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
function resolve (dir) {
return path.join(__dirname, dir)
@ -32,7 +34,14 @@ const vueConfig = {
// webpack plugins
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// 配置compression-webpack-plugin压缩
new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
],
// if prod, add externals
externals: isProd ? assetsCDN.externals : {}