Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-32033) feat(Poc): bundle splitting #7116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React, { lazy, Suspense } from 'react'

import { Artist } from 'features/artist/pages/Artist'
import { ForgottenPassword } from 'features/auth/pages/forgottenPassword/ForgottenPassword/ForgottenPassword'
import { ReinitializePassword } from 'features/auth/pages/forgottenPassword/ReinitializePassword/ReinitializePassword'
Expand Down Expand Up @@ -71,7 +73,6 @@ import { DeleteProfileSuccess } from 'features/profile/pages/DeleteProfile/Delet
import { SuspendAccountConfirmationWithoutAuthentication } from 'features/profile/pages/DeleteProfile/SuspendAccountConfirmationWithoutAuthentication'
import { DeleteProfileReason } from 'features/profile/pages/DeleteProfileReason/DeleteProfileReason'
import { FeedbackInApp } from 'features/profile/pages/FeedbackInApp/FeedbackInApp'
import { LegalNotices } from 'features/profile/pages/LegalNotices/LegalNotices'
import { NewEmailSelection } from 'features/profile/pages/NewEmailSelection/NewEmailSelection'
import { NotificationsSettings } from 'features/profile/pages/NotificationSettings/NotificationsSettings'
import { PersonalData } from 'features/profile/pages/PersonalData/PersonalData'
Expand All @@ -85,9 +86,18 @@ import { Venue } from 'features/venue/pages/Venue/Venue'
import { VenuePreviewCarousel } from 'features/venue/pages/VenuePreviewCarousel/VenuePreviewCarousel'
import { VenueMap } from 'features/venueMap/pages/VenueMap/VenueMap'
import { ABTestingPOC } from 'libs/firebase/remoteConfig/ABTestingPOC'
import { TypoDS } from 'ui/theme'

import { RootRoute } from './types'

const LegalNotices = lazy(async () => {
const module = await import('features/profile/pages/LegalNotices/LegalNotices')
await new Promise((resolve) => setTimeout(resolve, 4_000))
return {
default: module.LegalNotices,
}
})

export const routes: RootRoute[] = [
...accessibilityRoutes,
...culturalSurveyRoutes,
Expand Down Expand Up @@ -225,7 +235,11 @@ export const routes: RootRoute[] = [
},
{
name: 'LegalNotices',
component: LegalNotices,
component: () => (
<Suspense fallback={<TypoDS.Title1>CHARGEMENT...</TypoDS.Title1>}>
<LegalNotices />
</Suspense>
),
path: 'notices-legales',
options: { title: 'Informations légales' },
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LinkingOptions } from '@react-navigation/native'
import React, { lazy, Suspense } from 'react'

import { Bookings } from 'features/bookings/pages/Bookings/Bookings'
import { withAsyncErrorBoundary } from 'features/errors/hocs/withAsyncErrorBoundary'
Expand All @@ -8,8 +9,8 @@ import { getScreensAndConfig } from 'features/navigation/RootNavigator/linking/g
import { ScreenNames } from 'features/navigation/RootNavigator/types'
import { screenParamsParser } from 'features/navigation/screenParamsUtils'
import { searchNavigatorPathConfig } from 'features/navigation/SearchStackNavigator/routes'
import { SearchStackNavigator } from 'features/navigation/SearchStackNavigator/SearchStackNavigator'
import { Profile } from 'features/profile/pages/Profile'
import { TypoDS } from 'ui/theme'

import { TabStack } from './Stack'
import { TabParamList, TabRoute, TabRouteName } from './types'
Expand All @@ -18,6 +19,14 @@ export const initialRouteName = 'Home'

const Home = withAsyncErrorBoundary(HomeComponent)

const SearchStackNavigator = lazy(async () => {
const module = await import('features/navigation/SearchStackNavigator/SearchStackNavigator')
await new Promise((resolve) => setTimeout(resolve, 4_000))
return {
default: module.SearchStackNavigator,
}
})

const routes: TabRoute[] = [
{
name: 'Home',
Expand All @@ -27,7 +36,11 @@ const routes: TabRoute[] = [
},
{
name: 'SearchStackNavigator',
component: SearchStackNavigator,
component: () => (
<Suspense fallback={<TypoDS.Title1>CHARGEMENT...</TypoDS.Title1>}>
<SearchStackNavigator initialRouteName="SearchLanding" />
</Suspense>
),
pathConfig: searchNavigatorPathConfig,
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/libs/environment/env.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { Environment } from 'libs/environment/schema'

export const env: Environment = parseEnvironment({
...process.env,
API_BASE_URL: __DEV__ ? '' : (process.env.API_BASE_URL as string),
API_BASE_URL: '',
})
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default ({ mode }) => {
},
},
build: {
sourcemap: true,
sourcemap: false,
commonjsOptions: {
// https://github.com/rollup/plugins/tree/master/packages/commonjs
// Here go the options to pass on to @rollup/plugin-commonjs:
Expand Down
Loading