The blank screen resource that appears when vue is packaged cannot be loaded normally.

You can see a line like this in the dist index: We're sorry but xxxxxxx doesn't work properly without JavaScript enabled.

The high probability is:

  1. Add pubilcPath:'./' in vue.config.js (note that the relative path ./ is used here instead of the absolute path)

  1. Change routing into hash mode

Reason: Vue routing is divided into history mode and hash mode, and you choose the default history mode when you create a new Vue project.

So when you execute npm run build and there is no public path so the process.env.Base_URL in the screenshot cannot be loaded normally, you can also replace it with './'

If you just want the history mode, you can also use it in the local browser./But some resources cannot be loaded normally.

Tips: Use putstate to modify the history path

For in-depth understanding, please see: https://blog.csdn.net/muzidigbig/article/details/121892336?ops_request_misc=&request_id=&biz_id=102&utm_term=history%E5%92%8Chash%E6%A8%A1%E5%BC%8F %E7%9A%84%E6%89%93%E5%8C%85%E5%8C%BA%E5%88%AB&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0 -121892336.142^v73^control_1,201^v4^add_ask,239^v2^insert_chatgpt&spm=1018.2226.3001.4187

Guess you like

Origin blog.csdn.net/weixin_44383533/article/details/129204581