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 31509c8 commit cc774e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 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
8 changes: 6 additions & 2 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 @@ -73,6 +72,11 @@ export const commonRoutes: RouteObject[] = [
},
{
path: 'e2e',
element: process.env.REACT_APP_E2E_TEST ? <E2EPage /> : <div />,
lazy: process.env.REACT_APP_E2E_TEST
? async () => {
const { E2EPage } = await import('app/pages/E2EPage')
return { element: <E2EPage /> }
}
: undefined,

Check warning on line 80 in src/commonRoutes.tsx

View check run for this annotation

Codecov / codecov/patch

src/commonRoutes.tsx#L80

Added line #L80 was not covered by tests
},
]

0 comments on commit cc774e3

Please sign in to comment.