How to solve the problem that there is a mistake in the packaging path of vue multi-pages?

the problem now is that the back end needs to do something called path interception, so the folder hierarchy I packaged is shown in the figure.

since this is the case, how can I configure my build or config so that login.html and index.html can properly reference resources such as Js,css? And Login.html has a login that needs to be redirected to index.html. How to write this jump path?
I hope the boss will not hesitate to give us advice.

May.06,2021
The multi-entry file configuration of

webpack automatically generates multiple entry files. As for html, it is not important, you can create it yourself, as long as the referenced js is correct, you can


A project on hand is the same. It belongs to a multi-entry project with 3 html files and 3 js entry files
clipboard.png

config.jsHTMLDirshtml

clipboard.png

.

the webpack config section mainly pays attention to the three items of HTMLPlugins,Entries,chunks

.
let HTMLPlugins = []
let Entries = {}
let chunks = []

config.HTMLDirs.forEach((page) => {
  const htmlPlugin = new HtmlWebpackPlugin({
    filename: `${page}.html`,
    template: path.resolve(__dirname, `../src/html/${page}.html`),
    chunks: ['manifest','vendor', page],
    inject: true,
    ssUrl: config.dev.SS_URL
  });
  HTMLPlugins.push(htmlPlugin);
  Entries[page] = path.resolve(__dirname, `../src/js/${page}.js`);
})

//
plugins:[
// 
...HTMLPlugins,
new webpack.optimize.CommonsChunkPlugin({
  name: 'manifest',
  minChunks: Infinity
}),
new webpack.optimize.CommonsChunkPlugin({
  name: 'vendor',
  chunks: chunks,
  minChunks:3
}),
]

as for login jumping to index, it is OK to directly window.location.href = 'index.html', because it is a simple page jump, and there is no page routing

.

it is recommended to make dynamic reading similar to the second floor, instead of manually configuring multi-entry

.
Menu