From f2d6a722045348f04867545dd1da51d86fb1fb34 Mon Sep 17 00:00:00 2001 From: William Petit Date: Tue, 13 Oct 2020 12:08:43 +0200 Subject: [PATCH] Correction chargement dynamique --- client/src/components/App.tsx | 16 ++++++++-------- client/src/config.ts | 1 + client/src/index.tsx | 6 ++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/client/src/components/App.tsx b/client/src/components/App.tsx index 09495f3..2a94524 100644 --- a/client/src/components/App.tsx +++ b/client/src/components/App.tsx @@ -9,14 +9,14 @@ import { createClient } from '../util/apollo'; import { ApolloProvider } from '@apollo/client'; import { AppLoader } from './AppLoader'; -const LazyHomePage = React.lazy(() => import('./HomePage/HomePage')); -const LazyDashboardPage = React.lazy(() => import('./DashboardPage/DashboardPage')); -const LazyUnauthorizedPage = React.lazy(() => import('./UnauthorizedPage/UnauthorizedPage')); -const LazyConferencePage = React.lazy(() => import('./ConferencePage/ConferencePage')); -const LazyDecisionSupportFilePage = React.lazy(() => import('./DecisionSupportFilePage/DecisionSupportFilePage')); -const LazyProfilePage = React.lazy(() => import('./ProfilePage/ProfilePage')); -const LazyWorkgroupPage = React.lazy(() => import('./WorkgroupPage/WorkgroupPage')); -const LazyLogoutPage = React.lazy(() => import('./LogoutPage')); +const LazyHomePage = React.lazy(() => import(/* webpackChunkName: "HomePage" */'./HomePage/HomePage')); +const LazyDashboardPage = React.lazy(() => import(/* webpackChunkName: "DashboardPage" */'./DashboardPage/DashboardPage')); +const LazyUnauthorizedPage = React.lazy(() => import(/* webpackChunkName: "UnauthorizedPage" */'./UnauthorizedPage/UnauthorizedPage')); +const LazyConferencePage = React.lazy(() => import(/* webpackChunkName: "ConferencePage" */'./ConferencePage/ConferencePage')); +const LazyDecisionSupportFilePage = React.lazy(() => import(/* webpackChunkName: "DecisionSupportFilePage" */'./DecisionSupportFilePage/DecisionSupportFilePage')); +const LazyProfilePage = React.lazy(() => import(/* webpackChunkName: "ProfilePage" */'./ProfilePage/ProfilePage')); +const LazyWorkgroupPage = React.lazy(() => import(/* webpackChunkName: "WorkgroupPage" */'./WorkgroupPage/WorkgroupPage')); +const LazyLogoutPage = React.lazy(() => import(/* webpackChunkName: "LogoutPage" */'./LogoutPage')); export interface AppProps { diff --git a/client/src/config.ts b/client/src/config.ts index a9b4fb9..00a4328 100644 --- a/client/src/config.ts +++ b/client/src/config.ts @@ -4,6 +4,7 @@ export const Config = { graphQLEndpoint: get("graphQLEndpoint", "http://localhost:8081/api/v1/graphql"), subscriptionEndpoint: get("subscriptionEndpoint", "ws://localhost:8081/api/v1/graphql"), conferenceHeartbeatInterval: get("conferenceHeartbeatInterval", 10000), + frontendBaseURL: get("frontendBaseURL", window.location.protocol + '//' + window.location.host + '/'), }; function get(key: string, defaultValue: T):T { diff --git a/client/src/index.tsx b/client/src/index.tsx index 11d88f4..4de4533 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -1,3 +1,8 @@ +import { Config } from './config'; + +declare var __webpack_public_path__: string; +__webpack_public_path__ = Config.frontendBaseURL; + import './sass/_all.scss'; import React from 'react'; import ReactDOM from 'react-dom'; @@ -9,6 +14,7 @@ import '@fortawesome/fontawesome-free/js/regular' import '@fortawesome/fontawesome-free/js/brands' import './resources/favicon.png'; + ReactDOM.render( , document.getElementById('app')