npm run bulid 打包后 index.html 页面报错

npm run bulid 输出后 静态页面出现错误图片描述

main.js代码

import Vue from 'vue'
import App from './App'
import VueRouter from 'vue-router'
import routes from './router'
Vue.use(VueRouter)
// Vue.config.productionTip = false
const router = new VueRouter({
  mode: 'history',//去掉#
  routes
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

router.js代码

import Index from '@/views/index'
import Settled from '@/views/settled'
// const Index = () => import(/* webpackChunkName: "group-Index" */ '@/views/index');
// const Settled = () => import(/* webpackChunkName: "group-Settled" */ '@/views/settled');
let routes = [
  {
    path: '/',
    name: '首页',
    component: Index
  },
  {
    path: '/settled',
    name: '商家入驻',
    component: Settled
  },
  {
    path: '*',
    hidden: true,
    redirect: { path: '/404' }
  }
]
export default routes;
阅读 2k
2 个回答

去挑router.js里面自定义路由字段就好了

组件之间是不是有相互调用导致死锁的

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进