Skip to content

多页面应用,使用splitChunks插件抽取的chunk,不会被各个html页面自动引入(单页面没问题) #4382

@wubinsheng2017

Description

@wubinsheng2017

Version

3.8.4

Environment info

windows10   node10

Steps to reproduce

1、使用vue-cli3初始化的一个多页面应用,参照下面的链接配置了多页面
https://cli.vuejs.org/zh/config/#pages
pages:{
index:{
entry: filePath,
filename: index.html,
template: 'public/index.html',
hash: true,
chunks: ['chunk-vendors', 'index']
}
b: ......
}

2、在vue.config.js中添加splitChunks配置抽取共通chunk,如下:
config.optimization
.splitChunks({
chunks: 'all',
minChunks: 1,
maxInitialRequests: 4,
maxAsyncRequests: 5,
automaticNameDelimiter: '-',
.....
})

3、结果:
打包出来的index.html中,只引入了chunk-vendors.js index.js,
通过splitChunks共通出来的chunk文件,比如index~b.js,没有被引入index.js中。

因为动态生成的chunks的文件名不固定,如何让它们自动被引入对应的html中?

What is expected?

因为动态生成的chunks的文件名不固定,如何让它们自动被引入对应的html中?

What is actually happening?

动态生成的chunks,没有被引入到html中

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions