mirror of https://gitee.com/xiaonuobase/snowy
【更新】解决加载首页loading慢的问题,更多配置参见文档(https://doc.xiaonuo.vip)
parent
746dd25063
commit
eb166b58c1
|
@ -15,6 +15,7 @@
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"clipboard": "^2.0.6",
|
"clipboard": "^2.0.6",
|
||||||
|
"compression-webpack-plugin": "5.0.1",
|
||||||
"core-js": "^3.1.2",
|
"core-js": "^3.1.2",
|
||||||
"crypto-js": "^4.0.0",
|
"crypto-js": "^4.0.0",
|
||||||
"default-passive-events": "^1.0.10",
|
"default-passive-events": "^1.0.10",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const createThemeColorReplacerPlugin = require('./config/plugin.config')
|
const createThemeColorReplacerPlugin = require('./config/plugin.config')
|
||||||
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
|
const productionGzipExtensions = ['js', 'css']
|
||||||
|
|
||||||
function resolve (dir) {
|
function resolve (dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
|
@ -32,7 +34,14 @@ const vueConfig = {
|
||||||
// webpack plugins
|
// webpack plugins
|
||||||
plugins: [
|
plugins: [
|
||||||
// Ignore all locale files of moment.js
|
// 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
|
// if prod, add externals
|
||||||
externals: isProd ? assetsCDN.externals : {}
|
externals: isProd ? assetsCDN.externals : {}
|
||||||
|
|
Loading…
Reference in New Issue