开发环境:
基于Laravel 5.4 的框架,开发前后端分离的Web App
问题描述:
前端运行yarn run dev
或yarn run watch
打包后,访问站点提示如下错误:
Uncaught SyntaxError: Unexpected token <
和Error: Loading chunk 0 failed.at HTMLScriptElement.onScriptComplete (app.js:87)
但是运行yarn run hot
则能正常访问!
路由定义代码如下:
import Vue from 'vue';
import Router from 'vue-router';
const Administration = resolve => require(['../views/administration/Index.vue'], resolve);
const Attendance = resolve => require(['../views/administration/Attendance/Index.vue'], resolve);
const Dormitory = resolve => require(['../views/administration/Dormitory/Index.vue'], resolve);
import NotFound from '../views/error/NotFound.vue';
import Dashboard from '../views/Dashboard.vue';
Vue.use(Router);
const router = new Router({
mode: 'history',
linkActiveClass: 'active',
scrollbehavior: () => ({y: 0}),
routes: [
{
path: '/',
name: 'Dashboard',
component: Dashboard,
meta: {
title: 'Dashboard | EIP',
requiresAuth: true
},
children: [
{
path: 'administration',
name: 'Administration',
component: Administration,
meta: {
title: 'Administration | EIP',
requiresAuth: true
},
children: [
{
path: 'attendance',
name: 'Attendance',
component: Attendance,
meta: {
title: 'Attendance | EIP',
requiresAuth: true
}
}, {
path: 'dormitory',
name: 'Dormitory',
component: Dormitory,
meta: {
title: '宿舍管理 | EIP',
requiresAuth: true
}
}
]
}
]
}, {
path: '*',
name: 'NotFound',
component: NotFound
}
]
});
求老司机带路……
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…