Angular packaged and built the project server to run runtime.js, polyfills.js, vendor.js and reported an error net::ERR_ABORTED 404 (Not Found), and the build was modified to a relative path./

If the relative path is not used, it is likely that the resource file access must go through the root directory of the server.

http://domain name/project name/folder

Similar to the above directory, this will cause many index.html files accessed from the root directory Nginx configuration to be in the loading state, and all resource files will report error 404

solution:

In package.json "build": "ng build", change to the following

  "scripts": {
    
...

    "build":"ng build --base-href ./",

...

  },

Guess you like

Origin blog.csdn.net/qq_37860634/article/details/124107885