Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29e4dd5

Browse files
committed
chore: add preload-webpack-plugin and modify html-webpack-plugin version
1 parenteb9d068 commit29e4dd5

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

‎template/build/webpack.dev.conf.js‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
1111
constFriendlyErrorsPlugin=require('friendly-errors-webpack-plugin')
1212
constportfinder=require('portfinder')
1313
constCopyWebpackPlugin=require('copy-webpack-plugin')
14+
constPreloadPlugin=require('@vue/preload-webpack-plugin')
1415

1516
constuseYarn=fs.existsSync(`${config.directory.root}/yarn.lock`)
1617
constprotocol=process.env.HTTPS==='true' ?'https' :'http'
@@ -63,6 +64,23 @@ const devWebpackConfig = merge(baseWebpackConfig, {
6364
template:'index.html',
6465
inject:true
6566
}),
67+
newPreloadPlugin(
68+
{
69+
rel:'preload',
70+
include:'initial',
71+
fileBlacklist:[
72+
/\.map$/,
73+
/hot-update\.js$/
74+
]
75+
}
76+
),
77+
/* config.plugin('prefetch') */
78+
newPreloadPlugin(
79+
{
80+
rel:'prefetch',
81+
include:'asyncChunks'
82+
}
83+
),
6684
// copy custom static assets
6785
newCopyWebpackPlugin([
6886
{

‎template/build/webpack.prod.conf.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
1111
constMiniCssExtractPlugin=require('mini-css-extract-plugin')
1212
constOptimizeCSSAssetsPlugin=require('optimize-css-assets-webpack-plugin')
1313
constUglifyJsPlugin=require('uglifyjs-webpack-plugin')
14+
constPreloadPlugin=require('@vue/preload-webpack-plugin')
1415

1516
// For NamedChunksPlugin
1617
constseen=newSet()
@@ -67,6 +68,24 @@ const webpackConfig = merge(baseWebpackConfig, {
6768
//`runtime` must same as runtimeChunk name. default is `runtime`
6869
inline:/runtime\..*\.js$/
6970
}),
71+
newPreloadPlugin(
72+
{
73+
rel:'preload',
74+
include:'initial',
75+
fileBlacklist:[
76+
/\.map$/,
77+
/runtime\..*\.js$/,
78+
/hot-update\.js$/
79+
]
80+
}
81+
),
82+
/* config.plugin('prefetch') */
83+
newPreloadPlugin(
84+
{
85+
rel:'prefetch',
86+
include:'asyncChunks'
87+
}
88+
),
7089
// keep chunk.id stable when chunk has no name
7190
newwebpack.NamedChunksPlugin(chunk=>{
7291
if(chunk.name){

‎template/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"vue-router":"^3.0.1"
2525
},
2626
"devDependencies": {
27+
"@vue/preload-webpack-plugin":"^1.1.0",
2728
"address":"^1.0.3",
2829
"archiver":"^2.1.1",
2930
"autoprefixer":"^8.5.0",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp