Vue.js 多个html文件的Vue配置
默认情况下,Vue将生成Vue.js 多个html文件的Vue配置,vue.js,Vue.js,默认情况下,Vue将生成src/main.js,并将生成脚本注入public/index.html 有没有办法支持多个html文件 示例:我有public/index.html和public/not support.html,每个html还有两个脚本文件,src/main.jsfor和src/not support.jsforpublic/not support.html 构建后,我们将使用插入的单独脚本文件创建dist/index.html和dist/not support.html。如果使用
src/main.js
,并将生成脚本注入public/index.html
有没有办法支持多个html文件
示例:我有public/index.html
和public/not support.html
,每个html还有两个脚本文件,src/main.js
for和src/not support.js
forpublic/not support.html
构建后,我们将使用插入的单独脚本文件创建
dist/index.html
和dist/not support.html
。如果使用vue cli,可以在vue.config.js文件中设置config以支持多个html文件:
const config = {
devServer: {
open: true,
disableHostCheck: true,
},
pages: {
index: {
entry: 'src/index.js',
template: 'public/index.html',
filename: 'index.html',
},
support: {
entry: 'src/support.js',
template: 'public/support.html',
filename: 'support.html',
},
},
// ...config code
}
module.exports = config
请参阅,以多页模式构建应用程序
谢谢。如果使用vue cli,可以在vue.config.js文件中设置config以支持多个html文件:
const config = {
devServer: {
open: true,
disableHostCheck: true,
},
pages: {
index: {
entry: 'src/index.js',
template: 'public/index.html',
filename: 'index.html',
},
support: {
entry: 'src/support.js',
template: 'public/support.html',
filename: 'support.html',
},
},
// ...config code
}
module.exports = config
请参阅,以多页模式构建应用程序
谢谢