Skip to content

Commit

Permalink
feat(routing): lazy load views
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Jun 25, 2021
1 parent feb4971 commit efe952b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "vue-cli-service serve",
"lint": "eslint --fix",
"build": "vue-cli-service build",
"build": "vue-cli-service build --modern",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "start-server-and-test 'npm run dev -- --port 3030' 3030 'cypress open'"
},
Expand Down
28 changes: 20 additions & 8 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,30 @@ import {
rootResolver,
spaceBoardResolver
} from "./resolvers";
// Components

// Route components
import Layout from "@/Layout";
import Dashboard from "@/views/dashboard/Dashboard";
import ModelViewer from "@/views/model-viewer/ModelViewer";
import OidcCallback from "@/views/oidc-callback/OidcCallback";
import OidcCallbackError from "@/views/oidc-callback-error/OidcCallbackError";
import ProjectBoard from "@/views/project-board/ProjectBoard";
import ProjectGroups from "@/views/project-groups/ProjectGroups";
import SpaceBoard from "@/views/space-board/SpaceBoard";
import UserProjects from "@/views/user-projects/UserProjects";
import UserSpaces from "@/views/user-spaces/UserSpaces";

/* eslint-disable */
const Dashboard = () =>
import(/* webpackChunkName: "dashboard" */ "@/views/dashboard/Dashboard");
const ModelViewer = () =>
import(/* webpackChunkName: "model-viewer" */ "@/views/model-viewer/ModelViewer");
const ProjectBoard = () =>
import(/* webpackChunkName: "project-board" */ "@/views/project-board/ProjectBoard");
const ProjectGroups = () =>
import(/* webpackChunkName: "project-groups" */ "@/views/project-groups/ProjectGroups");
const SpaceBoard = () =>
import(/* webpackChunkName: "space-board" */ "@/views/space-board/SpaceBoard");
const UserProjects = () =>
import(/* webpackChunkName: "user-projects" */ "@/views/user-projects/UserProjects");
const UserSpaces = () =>
import(/* webpackChunkName: "user-spaces" */ "@/views/user-spaces/UserSpaces");
/* eslint-enable */

// Route names
const routeNames = Object.freeze({
root: "root",
oidcCallback: "oidc-callback",
Expand Down

0 comments on commit efe952b

Please sign in to comment.