-
-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not minify during code splitting
fixes #3183
- Loading branch information
1 parent
8f7c193
commit 322e865
Showing
78 changed files
with
1,176 additions
and
52 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
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
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
packages/router-plugin/tests/code-splitter/snapshots/development/chinese.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,9 @@ | ||
const $$splitComponentImporter = () => import('chinese.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/')({ | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr) | ||
}); | ||
interface DemoProps { | ||
title: string; | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/router-plugin/tests/code-splitter/snapshots/development/[email protected]
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,22 @@ | ||
interface DemoProps { | ||
title: string; | ||
} | ||
function Demo({ | ||
title | ||
}: DemoProps) { | ||
return <h1 style={{ | ||
color: '#2969ff', | ||
fontSize: '2rem', | ||
fontWeight: 'bold', | ||
letterSpacing: '3px' | ||
}}> | ||
{title} | ||
</h1>; | ||
} | ||
const component = function HomeComponent() { | ||
return <div className="p-2"> | ||
<Demo title="标题很好看,谁说不是呢?" /> | ||
<Demo title="The title looks great, who can deny that?" /> | ||
</div>; | ||
}; | ||
export { component }; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...router-plugin/tests/code-splitter/snapshots/development/[email protected]
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,3 @@ | ||
import { importedLoader } from '../shared/imported'; | ||
const loader = importedLoader; | ||
export { loader }; |
File renamed without changes.
Empty file.
File renamed without changes.
Empty file.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...snapshots/[email protected] → ...velopment/[email protected]
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
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
packages/router-plugin/tests/code-splitter/snapshots/production/arrow-function.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,9 @@ | ||
const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
const $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split'); | ||
import { lazyFn } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/posts')({ | ||
loader: lazyFn($$splitLoaderImporter, 'loader'), | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr) | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/router-plugin/tests/code-splitter/snapshots/production/[email protected]
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,29 @@ | ||
import { Link, Outlet } from '@tanstack/react-router'; | ||
import { fetchPosts } from '../posts'; | ||
import { Route } from "arrow-function.tsx"; | ||
const component = () => { | ||
const posts = Route.useLoaderData(); | ||
return <div className="p-2 flex gap-2"> | ||
<ul className="list-disc pl-4"> | ||
{[...posts, { | ||
id: 'i-do-not-exist', | ||
title: 'Non-existent Post' | ||
}]?.map(post => { | ||
return <li key={post.id} className="whitespace-nowrap"> | ||
<Link to="/posts/$postId" params={{ | ||
postId: post.id | ||
}} className="block py-1 text-blue-800 hover:text-blue-600" activeProps={{ | ||
className: 'text-black font-bold' | ||
}}> | ||
<div>{post.title.substring(0, 20)}</div> | ||
</Link> | ||
</li>; | ||
})} | ||
</ul> | ||
<hr /> | ||
<Outlet /> | ||
</div>; | ||
}; | ||
export { component }; | ||
const loader = fetchPosts; | ||
export { loader }; |
9 changes: 9 additions & 0 deletions
9
packages/router-plugin/tests/code-splitter/snapshots/production/chinese.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,9 @@ | ||
const $$splitComponentImporter = () => import('chinese.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/')({ | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr) | ||
}); | ||
interface DemoProps { | ||
title: string; | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/router-plugin/tests/code-splitter/snapshots/production/[email protected]
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,22 @@ | ||
interface DemoProps { | ||
title: string; | ||
} | ||
function Demo({ | ||
title | ||
}: DemoProps) { | ||
return <h1 style={{ | ||
color: '#2969ff', | ||
fontSize: '2rem', | ||
fontWeight: 'bold', | ||
letterSpacing: '3px' | ||
}}> | ||
{title} | ||
</h1>; | ||
} | ||
const component = function HomeComponent() { | ||
return <div className="p-2"> | ||
<Demo title="标题很好看,谁说不是呢?" /> | ||
<Demo title="The title looks great, who can deny that?" /> | ||
</div>; | ||
}; | ||
export { component }; |
9 changes: 9 additions & 0 deletions
9
...n/tests/code-splitter/snapshots/production/destructured-react-memo-imported-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,9 @@ | ||
const $$splitLoaderImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split'); | ||
import { lazyFn } from '@tanstack/react-router'; | ||
const $$splitComponentImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/')({ | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr), | ||
loader: lazyFn($$splitLoaderImporter, 'loader') | ||
}); |
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,9 @@ | ||
import { memo } from 'react'; | ||
import { importedLoader } from '../shared/imported'; | ||
function Component() { | ||
return <div>Component</div>; | ||
} | ||
const component = memo(Component); | ||
export { component }; | ||
const loader = importedLoader; | ||
export { loader }; |
11 changes: 11 additions & 0 deletions
11
packages/router-plugin/tests/code-splitter/snapshots/production/destructuring.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,11 @@ | ||
import thing from 'thing'; | ||
export function test() { | ||
const { | ||
foo: { | ||
bar: { | ||
destructured | ||
} | ||
} | ||
} = thing; | ||
return destructured; | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/router-plugin/tests/code-splitter/snapshots/production/[email protected]
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,11 @@ | ||
import thing from 'thing'; | ||
export function test() { | ||
const { | ||
foo: { | ||
bar: { | ||
destructured | ||
} | ||
} | ||
} = thing; | ||
return destructured; | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/router-plugin/tests/code-splitter/snapshots/production/function-as-parameter.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,19 @@ | ||
import * as React from 'react'; | ||
// @ts-expect-error | ||
import { useMemo } from 'tan-react'; | ||
const ReactUseMemoCall1 = React.useMemo(function performAction() { | ||
return 'true'; | ||
}, []); | ||
console.info(ReactUseMemoCall1); | ||
const ReactUseMemoCall2 = React.useMemo(() => { | ||
return 'true'; | ||
}, []); | ||
console.info(ReactUseMemoCall2); | ||
const UseMemoCall1 = useMemo(function performAction() { | ||
return 'true'; | ||
}, []); | ||
console.info(UseMemoCall1); | ||
const UseMemoCall2 = useMemo(() => { | ||
return 'true'; | ||
}, []); | ||
console.info(UseMemoCall2); |
19 changes: 19 additions & 0 deletions
19
...es/router-plugin/tests/code-splitter/snapshots/production/[email protected]
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,19 @@ | ||
import * as React from 'react'; | ||
// @ts-expect-error | ||
import { useMemo } from 'tan-react'; | ||
const ReactUseMemoCall1 = React.useMemo(function performAction() { | ||
return 'true'; | ||
}, []); | ||
console.info(ReactUseMemoCall1); | ||
const ReactUseMemoCall2 = React.useMemo(() => { | ||
return 'true'; | ||
}, []); | ||
console.info(ReactUseMemoCall2); | ||
const UseMemoCall1 = useMemo(function performAction() { | ||
return 'true'; | ||
}, []); | ||
console.info(UseMemoCall1); | ||
const UseMemoCall2 = useMemo(() => { | ||
return 'true'; | ||
}, []); | ||
console.info(UseMemoCall2); |
9 changes: 9 additions & 0 deletions
9
packages/router-plugin/tests/code-splitter/snapshots/production/function-declaration.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,9 @@ | ||
const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
const $$splitLoaderImporter = () => import('function-declaration.tsx?tsr-split'); | ||
import { lazyFn } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/posts')({ | ||
loader: lazyFn($$splitLoaderImporter, 'loader'), | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr) | ||
}); |
29 changes: 29 additions & 0 deletions
29
...ges/router-plugin/tests/code-splitter/snapshots/production/[email protected]
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,29 @@ | ||
import { Link, Outlet } from '@tanstack/react-router'; | ||
import { fetchPosts } from '../posts'; | ||
import { Route } from "function-declaration.tsx"; | ||
const component = function PostsComponent() { | ||
const posts = Route.useLoaderData(); | ||
return <div className="p-2 flex gap-2"> | ||
<ul className="list-disc pl-4"> | ||
{[...posts, { | ||
id: 'i-do-not-exist', | ||
title: 'Non-existent Post' | ||
}]?.map(post => { | ||
return <li key={post.id} className="whitespace-nowrap"> | ||
<Link to="/posts/$postId" params={{ | ||
postId: post.id | ||
}} className="block py-1 text-blue-800 hover:text-blue-600" activeProps={{ | ||
className: 'text-black font-bold' | ||
}}> | ||
<div>{post.title.substring(0, 20)}</div> | ||
</Link> | ||
</li>; | ||
})} | ||
</ul> | ||
<hr /> | ||
<Outlet /> | ||
</div>; | ||
}; | ||
export { component }; | ||
const loader = fetchPosts; | ||
export { loader }; |
9 changes: 9 additions & 0 deletions
9
...sts/code-splitter/snapshots/production/imported-default-component-destructured-loader.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,9 @@ | ||
const $$splitLoaderImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split'); | ||
import { lazyFn } from '@tanstack/react-router'; | ||
const $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/')({ | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr), | ||
loader: lazyFn($$splitLoaderImporter, 'loader') | ||
}); |
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,5 @@ | ||
import importedComponent, { importedLoader } from '../shared/imported'; | ||
const component = importedComponent; | ||
export { component }; | ||
const loader = importedLoader; | ||
export { loader }; |
6 changes: 6 additions & 0 deletions
6
...ges/router-plugin/tests/code-splitter/snapshots/production/imported-default-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,6 @@ | ||
const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split'); | ||
import { lazyRouteComponent } from '@tanstack/react-router'; | ||
import { createFileRoute } from '@tanstack/react-router'; | ||
export const Route = createFileRoute('/')({ | ||
component: lazyRouteComponent($$splitComponentImporter, 'component', () => Route.ssr) | ||
}); |
3 changes: 3 additions & 0 deletions
3
...uter-plugin/tests/code-splitter/snapshots/production/[email protected]
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,3 @@ | ||
import ImportedDefaultComponent from '../shared/imported'; | ||
const component = ImportedDefaultComponent; | ||
export { component }; |
Oops, something went wrong.