Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-phones-dedup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/react-start': patch
---

Deduplicate React packages in the React Start Rsbuild plugin.
13 changes: 13 additions & 0 deletions packages/react-start/src/plugin/rsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ import type {
} from '@tanstack/start-plugin-core/rsbuild'
import type { RsbuildPlugin } from '@rsbuild/core'

const reactStartRsbuildEnvironmentOverrides = {
all: {
resolve: {
dedupe: ['react', 'react-dom'],
},
},
} satisfies NonNullable<
TanStackStartRsbuildPluginCoreOptions['rsbuild']
>['environments']

export function tanstackStart(
options?: TanStackStartRsbuildInputConfig & { rsc?: { enabled?: boolean } },
): RsbuildPlugin {
Expand All @@ -20,6 +30,9 @@ export function tanstackStart(
defaultEntryPaths: reactStartDefaultEntryPaths,
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
ssrIsProvider: true,
rsbuild: {
environments: reactStartRsbuildEnvironmentOverrides,
},
}

if (rscEnabled) {
Expand Down
Loading