How to solve the problem that modifying the startup path of Vue does not take effect

In the Vue project, sometimes we need to modify the startup path of the project, but we find that the modification does not take effect. Below I'll describe some possible solutions.

  1. Make sure you modify the correct files

When we want to modify the startup path of the Vue project, we usually need to modify vue.config.jsthe file. Please make sure you modify the correct file and not another configuration file.

  1. Configure publicPath

In vue.config.jsthe file, you can publicPathmodify the project's startup path through configuration. This path specifies the base path of the project on the server, which can be a relative path or an absolute path.

Here is an example vue.config.jsfile:

module.exports = {
   
    
    
  publicPath: '/your-custom-path/',
};

In the above example, we modified the startup path to /your-custom-path/. You can according to your project

Guess you like

Origin blog.csdn.net/2301_79326254/article/details/133446376