Skip to content

Commit

Permalink
Fix tree-shaking E2E page in production
Browse files Browse the repository at this point in the history
TypeScript's import elision doesn't work with Parcel's dead branch removal.
  • Loading branch information
lukaw3d committed Jan 11, 2024
1 parent c933e1d commit e9b0ec9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/1825.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix tree-shaking E2E page in production
15 changes: 10 additions & 5 deletions src/commonRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ActiveDelegationList } from 'app/pages/StakingPage/Features/DelegationL
import { DebondingDelegationList } from 'app/pages/StakingPage/Features/DelegationList/DebondingDelegationList'
import { ParaTimes } from 'app/pages/ParaTimesPage'
import { FiatOnramp } from 'app/pages/FiatOnrampPage'
import { E2EPage } from 'app/pages/E2EPage'
import { ErrorBoundary } from 'app/components/ErrorBoundary'

export const commonRoutes: RouteObject[] = [
Expand Down Expand Up @@ -71,8 +70,14 @@ export const commonRoutes: RouteObject[] = [
path: 'open-wallet/ledger',
element: <FromLedger />,
},
{
path: 'e2e',
element: process.env.REACT_APP_E2E_TEST ? <E2EPage /> : <div />,
},
]

if (process.env.REACT_APP_E2E_TEST) {
commonRoutes.push({
path: 'e2e',
lazy: async () => {
const { E2EPage } = await import('app/pages/E2EPage')
return { element: <E2EPage /> }
},
})
}

0 comments on commit e9b0ec9

Please sign in to comment.