-
-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router-plugin): do not split if known ident is exported (#2334)
- Loading branch information
1 parent
db02bef
commit df67018
Showing
13 changed files
with
491 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/router-plugin/tests/code-splitter/snapshots/retain-export-component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const $$splitLoaderImporter = () => import('tsr-split:retain-export-component.tsx?tsr-split'); | ||
import { lazyFn } from '@tanstack/react-router'; | ||
import { createFileRoute, Outlet } from '@tanstack/react-router'; | ||
import { importedComponent as ImportedComponent } from '../shared/imported'; | ||
export function Layout() { | ||
return <main> | ||
<header style={{ | ||
height: HEADER_HEIGHT | ||
}}> | ||
<nav> | ||
<ul> | ||
<li> | ||
<a href="/">Home</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</header> | ||
<ImportedComponent /> | ||
<Outlet /> | ||
</main>; | ||
} | ||
export const Route = createFileRoute('/_layout')({ | ||
component: Layout, | ||
loader: lazyFn($$splitLoaderImporter, 'loader') | ||
}); | ||
const HEADER_HEIGHT = '63px'; | ||
export const SIDEBAR_WIDTH = '150px'; |
4 changes: 4 additions & 0 deletions
4
packages/router-plugin/tests/code-splitter/snapshots/retain-export-component@split.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
console.warn("These exports from \"retain-export-component.tsx\" are not being code-split and will increase your bundle size: \n- Layout\nThese should either have their export statements removed or be imported from another file that is not a route."); | ||
import { importedLoader } from '../shared/imported'; | ||
const loader = importedLoader; | ||
export { loader }; |
Oops, something went wrong.