How should vue-cli run after building the project npm run build to view the effect locally

At this time, if you run it directly npn run build, you can run and package the code, and no exception or error will be reported, but you will see a prompt like this when your command line is packaged:

    Tip: built files are meant to be served over an HTTP server

    Opening index.html over file:// won't work.

At this time, use the browser to open the file in the directory you just buildgenerated , and you will find that the web page is blank with no trace at all. After opening the console, you will see the next piece of various resources that cannot be found;distindex.htmlconsole tab404

At this time, go to the object in the file in the configfolder under the project directory , change the in , to , just add a dot in front, and delete or comment out the prompt information of these two sentences, Then package it and run it directly with the browser.index.jsbuildassetsPublicPath“/”“./”build\build.js

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325264498&siteId=291194637