1、npm run build打包,dist的index是空白頁
問題一:assetsPublicPath配置錯誤
解決方法:修改config/index.js文件
問題二:路由history模式配置有誤
export default new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({
y: 0
}),
routes: constantRouterMap
})
(暫時還未親自驗證過,history模式在router的index.js中設置)
2、npm run build打包,圖片等資源不顯示
解決方法:
在builde下的utils.js中,使用 ‘vue-style-loader’ 依賴的地方添加 publicPath: '../../' , 如圖: