When using a run bulid package npm, open the dist / index.html will find a blank, and there is an error, you can not load the resource
solution:
找到config/index.js文件,
第39行
build:{
assetsPublicPath: './',
}
将assetsPublicPath: / 前加上点
assetsPublicPath属性作用是指定编译发布的根目录,‘/‘指的是项目的根目录 ,’./‘指的是当前目录。
第二个坑:路由history模式。
当路由开启history模式,打包的文件放到服务器会发现访问不到页面, 将mode:'history'注释重新打包即可
这里并不是说不能打开这个模式,这个模式需要后端设置的配合,详情可以看: