The project created by vue-cli scaffolding cannot be opened normally after being packaged, and the error Failed to load resource: net::ERR_FILE_NOT_FOUND is reported.

Dear friends, have you recently encountered the situation that the index.html file cannot be opened normally after using the latest scaffolding to package the project, and then the console reports an error? Don’t worry, I stepped on this pit today and I solved it Now, let me share my experience with you!

1. Find the vue.config.js file and configure it as follows

That is, add a line of configuration: publiccPath:'./'

 2. Find the router.js file and turn off the history mode

 

3. After completing the configuration, re-enter the command and package again, you will find that the packaged project can be accessed normally

Guess you like

Origin blog.csdn.net/LLL3189860667/article/details/131895025