not use Lazy Loading In dev

This commit is contained in:
Pan 2017-06-21 16:58:03 +08:00 committed by 花裤衩
parent 657937c7a5
commit 046d1369d2
3 changed files with 40 additions and 35 deletions

View file

@ -0,0 +1 @@
module.exports = file => require('../views/' + file + '.vue')

View file

@ -0,0 +1 @@
module.exports = file => () => import('../views/' + file + '.vue')

View file

@ -1,67 +1,70 @@
import Vue from 'vue'; import Vue from 'vue';
import Router from 'vue-router'; import Router from 'vue-router';
const _import = require('./_import_' + process.env.NODE_ENV);
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow
// so only in production use Lazy Loading
/* layout */ /* layout */
import Layout from '../views/layout/Layout'; import Layout from '../views/layout/Layout';
/* login */ /* login */
import Login from '../views/login/'; const Login = _import('login/index');
const authRedirect = () => import('../views/login/authredirect'); const authRedirect = _import('login/authredirect');
const sendPWD = () => import('../views/login/sendpwd'); const sendPWD = _import('login/sendpwd');
const reset = () => import('../views/login/reset'); const reset = _import('login/reset');
/* dashboard */ /* dashboard */
const dashboard = () => import('../views/dashboard/index'); const dashboard = _import('dashboard/index');
/* Introduction */ /* Introduction */
const Introduction = () => import('../views/introduction/index'); const Introduction = _import('introduction/index');
/* components */ /* components */
const componentsIndex = () => import('../views/components/index'); const componentsIndex = _import('components/index');
const Tinymce = () => import('../views/components/tinymce'); const Tinymce = _import('components/tinymce');
const Markdown = () => import('../views/components/markdown'); const Markdown = _import('components/markdown');
const JsonEditor = () => import('../views/components/jsoneditor'); const JsonEditor = _import('components/jsoneditor');
const DndList = () => import('../views/components/dndlist'); const DndList = _import('components/dndlist');
const AvatarUpload = () => import('../views/components/avatarUpload'); const AvatarUpload = _import('components/avatarUpload');
const Dropzone = () => import('../views/components/dropzone'); const Dropzone = _import('components/dropzone');
const Sticky = () => import('../views/components/sticky'); const Sticky = _import('components/sticky');
const SplitPane = () => import('../views/components/splitpane'); const SplitPane = _import('components/splitpane');
const CountTo = () => import('../views/components/countTo'); const CountTo = _import('components/countTo');
const Mixin = () => import('../views/components/mixin'); const Mixin = _import('components/mixin');
/* charts */ /* charts */
const chartIndex = () => import('../views/charts/index'); const chartIndex = _import('charts/index');
const KeyboardChart = () => import('../views/charts/keyboard'); const KeyboardChart = _import('charts/keyboard');
const KeyboardChart2 = () => import('../views/charts/keyboard2'); const KeyboardChart2 = _import('charts/keyboard2');
const LineMarker = () => import('../views/charts/line'); const LineMarker = _import('charts/line');
const MixChart = () => import('../views/charts/mixchart'); const MixChart = _import('charts/mixchart');
/* error page */ /* error page */
const Err404 = () => import('../views/error/404'); const Err404 = _import('error/404');
const Err401 = () => import('../views/error/401'); const Err401 = _import('error/401');
/* error log */ /* error log */
const ErrorLog = () => import('../views/errlog/index'); const ErrorLog = _import('errlog/index');
/* excel */ /* excel */
const ExcelDownload = () => import('../views/excel/index'); const ExcelDownload = _import('excel/index');
/* theme */ /* theme */
const Theme = () => import('../views/theme/index'); const Theme = _import('theme/index');
/* example*/ /* example*/
const TableLayout = () => import('../views/example/table/index'); const TableLayout = _import('example/table/index');
const DynamicTable = () => import('../views/example/table/dynamictable'); const DynamicTable = _import('example/table/dynamictable');
const Table = () => import('../views/example/table/table'); const Table = _import('example/table/table');
const DragTable = () => import('../views/example/table/dragTable'); const DragTable = _import('example/table/dragTable');
const InlineEditTable = () => import('../views/example/table/inlineEditTable'); const InlineEditTable = _import('example/table/inlineEditTable');
const Form = () => import('../views/example/form'); const Form = _import('example/form');
const Tab = () => import('../views/example/tab/index'); const Tab = _import('example/tab/index');
/* permission */ /* permission */
const Permission = () => import('../views/permission/index'); const Permission = _import('permission/index');
Vue.use(Router); Vue.use(Router);