Problems with history routing in multi-entry single-page applications

problem description

using vue-router "s history mode, there is no problem with the spa application with a single entry, but there is a problem with a page with multiple entries configured.
the project template is here: https://github.com/lwpersonal.

the environmental background of the problems and what methods you have tried

there are two entries, app1/index.html and app2/index.html, and multiple

may be added later.

start trying to modify the configuration of devServer

devServer: {
    ...
    historyApiFallback: {
      verbose: true,
      htmlAcceptHeaders: ["text/html", "application/xhtml+xml"],
      rewrites: [
        // 
        { from: /^\/app2\/index.html/, to: "/app2/index.html" },
        
        // 
        { from: /app2\/.*/, to: path.posix.join(config.dev.assetsPublicPath, "app2/index.html") },
        
        // 
        { from: /.*/, to: "/app2" }
      ]
    },
    ...
  }

then there is no effect

clipboard.png

node




clipboard.png

also has the prompt to redirect, but does not change the page. The result is the same.
then I try to change the parameters after to to absolute address, https://www.baidu.com, etc., but it has no effect

.

has been resolved, and there is no problem with this configuration, which is caused by my configuration in package.json that overrides the configuration in the file.

Menu