From 290b4ba7d32542c954c979cbfac4884e45a1e57f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 31 May 2019 15:13:07 +0200 Subject: [PATCH] Make event & create event & map async components Signed-off-by: Thomas Citharel --- js/src/router/event.ts | 13 ++++++++----- js/src/views/Event/Event.vue | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/js/src/router/event.ts b/js/src/router/event.ts index b466e1e7f..928119b1b 100644 --- a/js/src/router/event.ts +++ b/js/src/router/event.ts @@ -1,9 +1,12 @@ import EventList from '@/views/Event/EventList.vue'; import Location from '@/views/Location.vue'; -import CreateEvent from '@/views/Event/Create.vue'; -import Event from '@/views/Event/Event.vue'; import { RouteConfig } from 'vue-router'; +// tslint:disable:space-in-parens +const createEvent = () => import(/* webpackChunkName: "create-event" */ '@/views/Event/Create.vue'); +const event = () => import(/* webpackChunkName: "event" */ '@/views/Event/Event.vue'); +// tslint:enable + export enum EventRouteName { EVENT_LIST = 'EventList', CREATE_EVENT = 'CreateEvent', @@ -22,13 +25,13 @@ export const eventRoutes: RouteConfig[] = [ { path: '/events/create', name: EventRouteName.CREATE_EVENT, - component: CreateEvent, + component: createEvent, meta: { requiredAuth: true }, }, { path: '/events/:id/edit', name: EventRouteName.EDIT_EVENT, - component: CreateEvent, + component: createEvent, props: true, meta: { requiredAuth: true }, }, @@ -41,7 +44,7 @@ export const eventRoutes: RouteConfig[] = [ { path: '/events/:uuid', name: EventRouteName.EVENT, - component: Event, + component: event, props: true, meta: { requiredAuth: false }, }, diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index 0d555d544..74b638250 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -249,7 +249,9 @@ import EventFullDate from '@/components/Event/EventFullDate.vue'; EventCard, BIcon, DateCalendarIcon, - 'map-leaflet': () => import('@/components/Map.vue'), + // tslint:disable:space-in-parens + 'map-leaflet': () => import(/* webpackChunkName: "map" */ '@/components/Map.vue'), + // tslint:enable }, apollo: { event: {