首先查看项目文件package.json文件

Vue项目部署打包

 

 

 查看build命令 ,打开控制台执行命令npm run build

然后可以查看config/index.js

Vue项目部署打包

 

 

 默认输出文件夹名为dist,可以根据自己需要进行更改

显示项目构建完成之后可以在test文件夹中看到index.html文件,这时可以打开index.html为空白页面,控制台显示文件路径未找到,

修改config/index.js的

assetsPublicPath 为,/

Vue项目部署打包

 

 这时打开index.html可以看到正常页面,

如果涉及vue-router

vue-router默认为hash模式,如果为histtory模式改为hash模式

Vue项目部署打包

 

 

相关文章:

  • 2021-10-02
  • 2021-12-16
  • 2021-04-14
  • 2021-07-13
  • 2021-07-01
  • 2021-09-20
猜你喜欢
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-06-24
  • 2021-09-30
  • 2022-12-23
相关资源
相似解决方案