When I first came into contact with the vue project, the project packaged the dist file. After being deployed to tomcat, the static image could not be found.

  • the project packages the dist file. After it is deployed to tomcat, it cannot be accessed. Change the"/"of assetsPublicPath to". /", the project can be accessed normally, but the picture always cannot be displayed
  • .
  • build parameters
// Template for index.html
    index: path.resolve(__dirname, "../dist/index.html"),
    // Paths
    assetsRoot: path.resolve(__dirname, "../dist"),
    assetsSubDirectory: "static",
    assetsPublicPath: "./",
  • Project structure

what is the reason why the picture hasn"t come out all the time?


Pack path question click on the console network to take a closer look at the path of report 404 must be different from what you think

Menu