0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/packages/router-plugin/tests/code-splitter/test-files/react/export-default-component.tsx
Sean Cassiere e9b253ebfd
fix(router-plugin): code-splitting to handle default exported function declarations (#3901)
Currently, when the code-splitter encounters a known identifier used for
configuration in `createFileRoute` (such as `component`, `loader`,
`errorComponent`, etc.) it retains the export without splitting it out
into a separate file.

This functionality is currently partially working when the export is a
"default export" which references an already declared identifier.

```ts
const loader = () => {}
export default loader
```

However, it does not work when the "default export" is also making a
function declaration for the export.

```ts
export default function loader() {}
```

This PR adds the functionality to detect this use case and perform the
same transformations to align itself with the behaviour for all others
exports.
2025-04-01 10:14:32 +13:00

16 lines
319 B