美文网首页
vue-config.js配置实战 打包项目(简单步骤)

vue-config.js配置实战 打包项目(简单步骤)

作者: 程序媛可可 | 来源:发表于2020-09-14 12:00 被阅读0次

步骤一

先把router(路由)里面的 mode:'history' 注释

const router = new VueRouter({
 // mode: 'history', (就是这里注释,否则需要后端帮忙整改)
  base: process.env.BASE_URL,
  routes
})

export default router

步骤二

在根目录创建一个vue.config.js,添加以下以下内容

module.exports = {
    publicPath: './',
}

步骤三

直接执行命令
yarn bulid / npm bulid

相关文章

网友评论

      本文标题:vue-config.js配置实战 打包项目(简单步骤)

      本文链接:https://www.haomeiwen.com/subject/yhxzektx.html