Skip to content

Commit 73a9ab0

Browse files
authored
fix[chore]: do not preload runtime.js (PanJiaChen#3279)
1 parent 5853912 commit 73a9ab0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

vue.config.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ module.exports = {
5050
},
5151
chainWebpack(config) {
5252
// it can improve the speed of the first screen, it is recommended to turn on preload
53-
// config.plugins.delete('preload')
53+
// it can improve the speed of the first screen, it is recommended to turn on preload
54+
config.plugin('preload').tap(() => [
55+
{
56+
rel: 'preload',
57+
// to ignore runtime.js
58+
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
59+
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
60+
include: 'initial'
61+
}
62+
])
5463

5564
// when there are many pages, it will cause too many meaningless requests
5665
config.plugins.delete('prefetch')
@@ -118,6 +127,7 @@ module.exports = {
118127
}
119128
}
120129
})
130+
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
121131
config.optimization.runtimeChunk('single')
122132
}
123133
)

0 commit comments

Comments
 (0)