Compare commits

...

3 Commits

Author SHA1 Message Date
花裤衩
8d81c98539 perf[getInfo]: stop run after reject 2020-06-26 18:41:35 +08:00
花裤衩
7c06214190 perf[chore]: remove preserveWhitespace config (#3280) 2020-06-24 10:17:57 +08:00
花裤衩
73a9ab0379 fix[chore]: do not preload runtime.js (#3279) 2020-06-23 21:12:44 +08:00
2 changed files with 13 additions and 14 deletions

View File

@@ -51,14 +51,14 @@ const actions = {
const { data } = response
if (!data) {
reject('Verification failed, please Login again.')
return reject('Verification failed, please Login again.')
}
const { roles, name, avatar, introduction } = data
// roles must be a non-empty array
if (!roles || roles.length <= 0) {
reject('getInfo: roles must be a non-null array!')
return reject('getInfo: roles must be a non-null array!')
}
commit('SET_ROLES', roles)

View File

@@ -50,7 +50,16 @@ module.exports = {
},
chainWebpack(config) {
// it can improve the speed of the first screen, it is recommended to turn on preload
// config.plugins.delete('preload')
// it can improve the speed of the first screen, it is recommended to turn on preload
config.plugin('preload').tap(() => [
{
rel: 'preload',
// to ignore runtime.js
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
include: 'initial'
}
])
// when there are many pages, it will cause too many meaningless requests
config.plugins.delete('prefetch')
@@ -72,17 +81,6 @@ module.exports = {
})
.end()
// set preserveWhitespace
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
.end()
config
.when(process.env.NODE_ENV !== 'development',
config => {
@@ -118,6 +116,7 @@ module.exports = {
}
}
})
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
config.optimization.runtimeChunk('single')
}
)