encountered a problem while making Vue-cli3.0 multi-page configuration.
if I add the chunks parameter to the pages object in vue.confog.js , the js file will not be automatically introduced into the packaged entry index.html, resulting in no js execution at all.
doesn"t quite understand the meaning of each value in the pages.chunks array in vue.config.js . Is there a boss who can explain. The two sentences on the official website are completely inexplicable.
https://cli.vuejs.org/zh/conf...
//
// chunk vendor chunk
chunks: ["chunk-vendors", "chunk-common", "index"]
throw the source code later. I can"t use github for the time being.
// vue.config.js
const isDev = process.env.NODE_ENV !== "production"
const businessArray = [
{chunk: "note", chunkName: ""},
{chunk: "evaluate", chunkName: ""}
]
let pages = {}
businessArray.forEach(v => {
pages[v.chunk] = {
// page
entry: `src/business/${v.chunk}/index.js`,
//
template: "public/index.html",
// dist/index.html
filename: `business/${v.chunk}/index.html`,
// title
// template title <title><%= htmlWebpackPlugin.options.title %></title>
title: v.chunkName,
//
// chunk vendor chunk
// chunksjs
//
// chunks: ["chunk-vendorssss", "chunk-common", `${v.chunk}/index.html`]
}
})
module.exports = {
baseUrl: isDev ? "/" : "../",
pages,
assetsDir: "common"
}
