Merge branch 'feature/lazy_load' into develop

This commit is contained in:
Paulo Gustavo Veiga 2022-08-15 20:01:51 -07:00
commit 0aec66b1e3
2 changed files with 20 additions and 11 deletions

View File

@ -1,7 +1,6 @@
import React, { ReactElement } from 'react'; import React, { ReactElement, Suspense } from 'react';
import { IntlProvider } from 'react-intl'; import { IntlProvider } from 'react-intl';
import { Route, Switch, Redirect, BrowserRouter as Router } from 'react-router-dom'; import { Route, Switch, Redirect, BrowserRouter as Router } from 'react-router-dom';
import RegistrationSuccessPage from './components/registration-success-page';
import ForgotPasswordSuccessPage from './components/forgot-password-success-page'; import ForgotPasswordSuccessPage from './components/forgot-password-success-page';
import RegistationPage from './components/registration-page'; import RegistationPage from './components/registration-page';
import LoginPage from './components/login-page'; import LoginPage from './components/login-page';
@ -11,14 +10,16 @@ import { Provider } from 'react-redux';
import { QueryClient, QueryClientProvider } from 'react-query'; import { QueryClient, QueryClientProvider } from 'react-query';
import { theme } from './theme'; import { theme } from './theme';
import AppI18n, { Locales } from './classes/app-i18n'; import AppI18n, { Locales } from './classes/app-i18n';
import MapsPage from './components/maps-page';
import CssBaseline from '@mui/material/CssBaseline'; import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider, Theme, StyledEngineProvider } from '@mui/material/styles'; import { ThemeProvider, Theme, StyledEngineProvider } from '@mui/material/styles';
import ReactGA from 'react-ga4'; import ReactGA from 'react-ga4';
import EditorPage from './components/editor-page';
import AppConfig from './classes/app-config'; import AppConfig from './classes/app-config';
import withSessionExpirationHandling from './components/HOCs/withSessionExpirationHandling'; import withSessionExpirationHandling from './components/HOCs/withSessionExpirationHandling';
const EditorPage = React.lazy(() => import('./components/editor-page'));
const RegistrationSuccessPage = React.lazy(() => import('./components/registration-success-page'));
const MapsPage = React.lazy(() => import('./components/maps-page'));
declare module '@mui/styles/defaultTheme' { declare module '@mui/styles/defaultTheme' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface // eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DefaultTheme extends Theme {} interface DefaultTheme extends Theme {}
@ -65,16 +66,20 @@ const App = (): ReactElement => {
<Route path="/c/registration-success" component={RegistrationSuccessPage} /> <Route path="/c/registration-success" component={RegistrationSuccessPage} />
<Route path="/c/forgot-password" component={ForgotPasswordPage} /> <Route path="/c/forgot-password" component={ForgotPasswordPage} />
<Route path="/c/forgot-password-success" component={ForgotPasswordSuccessPage} /> <Route path="/c/forgot-password-success" component={ForgotPasswordSuccessPage} />
<Route <Route exact path="/c/maps/">
exact <Suspense fallback={<div></div>}>
path="/c/maps/" <MapsPage />
component={withSessionExpirationHandling(MapsPage)} </Suspense>
/> </Route>
<Route exact path="/c/maps/:id/edit"> <Route exact path="/c/maps/:id/edit">
<EnhacedEditorPage isTryMode={false} /> <Suspense fallback={<div></div>}>
<EnhacedEditorPage isTryMode={false} />
</Suspense>
</Route> </Route>
<Route exact path="/c/maps/:id/try"> <Route exact path="/c/maps/:id/try">
<EnhacedEditorPage isTryMode={true} /> <Suspense fallback={<div></div>}>
<EnhacedEditorPage isTryMode={true} />
</Suspense>
</Route> </Route>
</Switch> </Switch>
</Router> </Router>

View File

@ -38,6 +38,10 @@ module.exports = {
}, },
optimization: { optimization: {
usedExports: true, usedExports: true,
<<<<<<< HEAD
=======
chunkIds: 'named',
>>>>>>> feature/lazy_load
splitChunks: { splitChunks: {
cacheGroups: { cacheGroups: {
vendors: { vendors: {