1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import App from "views/App";
- const errorLoading = error => {
- throw new Error(`Dynamic page loading failed: ${ error }`);
- };
- const loadRoute = cb => {
- return module => cb(null, module.default);
- };
- export default {
- path: "/",
- component: App,
- indexRoute: {
- getComponent(location, cb) {
- System.import("views/Home")
- .then(loadRoute(cb))
- .catch(errorLoading);
- },
- },
- childRoutes: [
- {
- path: "home",
- getComponent(location, cb) {
- System.import("views/Home")
- .then(loadRoute(cb, false))
- .catch(errorLoading);
- },
- },
- {
- path: "template",
- getComponent(location, cb) {
- System.import("views/Template")
- .then(loadRoute(cb, false))
- .catch(errorLoading);
- },
- },
- {
- path: "*",
- getComponent(location, cb) {
- System.import("views/NotFound")
- .then(loadRoute(cb))
- .catch(errorLoading);
- },
- },
- ],
- };
|