Skip to content
Open
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
8 changes: 8 additions & 0 deletions .changeset/quiet-rsbuild-preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@tanstack/start-plugin-core': patch
'@tanstack/react-start': patch
---

Fix Rsbuild preview support for TanStack Start SSR and rename the middleware option to `installServerMiddleware`.

Deduplicate `react` and `react-dom` in the React Start Rsbuild integration.
2 changes: 1 addition & 1 deletion benchmarks/bundle-size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-plugin": "workspace:^",
"@types/react": "^19.0.8",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-router/rspack-basic-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
7 changes: 6 additions & 1 deletion e2e/react-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build:vite": "vite build && tsc --noEmit",
"build:rsbuild": "rsbuild build && tsc --noEmit",
"preview": "vite preview",
"preview:rsbuild": "rsbuild preview",
"start": "node server.js",
"test:e2e:startDummyServer": "node -e 'import(\"./tests/setup/global.setup.ts\").then(m => m.default())' & node -e 'import(\"./tests/setup/waitForDummyServer.ts\").then(m => m.default())'",
"test:e2e:stopDummyServer": "node -e 'import(\"./tests/setup/global.teardown.ts\").then(m => m.default())'",
Expand All @@ -31,7 +32,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
Expand Down Expand Up @@ -86,6 +87,10 @@
{
"toolchain": "rsbuild",
"mode": "prerender"
},
{
"toolchain": "rsbuild",
"mode": "preview"
}
]
}
Expand Down
8 changes: 7 additions & 1 deletion e2e/react-start/basic/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import packageJson from './package.json' with { type: 'json' }

const mode = process.env.MODE ?? 'ssr'
const toolchain = process.env.E2E_TOOLCHAIN ?? 'vite'
const e2ePortKey = process.env.E2E_PORT_KEY ?? packageJson.name
const distDir = process.env.E2E_DIST_DIR ?? 'dist'

Expand All @@ -24,9 +25,13 @@ const PORT = await getTestServerPort(e2ePortKey)
const START_PORT = await getTestServerPort(`${e2ePortKey}_start`)
const EXTERNAL_PORT = await getDummyServerPort(e2ePortKey)
const baseURL = `http://localhost:${PORT}`
const previewCommand =
toolchain === 'rsbuild'
? `pnpm preview:rsbuild --port ${PORT}`
: `pnpm preview --outDir ${distDir} --port ${PORT}`
const commandByMode =
mode === 'preview'
? `pnpm run test:e2e:startDummyServer && pnpm preview --outDir ${distDir} --port ${PORT}`
? `pnpm run test:e2e:startDummyServer && ${previewCommand}`
: `pnpm run test:e2e:startDummyServer && pnpm start`
/**
* See https://playwright.dev/docs/test-configuration.
Expand All @@ -50,6 +55,7 @@ export default defineConfig({
stdout: 'pipe',
env: {
MODE: mode,
E2E_TOOLCHAIN: toolchain,
VITE_NODE_ENV: 'test',
VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),
VITE_SERVER_PORT: String(PORT),
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/css-inline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/custom-server-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions e2e/react-start/custom-server-rsbuild/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
// explicit prefix.
export default defineConfig({
plugins: [
pluginReact(),
pluginReact({ splitChunks: false }),
tanstackStart({
rsbuild: {
installDevServerMiddleware: false,
installServerMiddleware: false,
client: {
output: 'iife',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/deferred-hydration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
"@rsbuild/core": "^2.0.1",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/hmr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/import-protection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/rsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/eslint-plugin-start": "workspace:^",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/server-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/solid-router/rspack-basic-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-solid": "^1.1.1",
"@tailwindcss/postcss": "^4.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-solid": "^1.1.1",
"@tailwindcss/postcss": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/solid-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-solid": "^1.1.1",
"@tailwindcss/postcss": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion e2e/solid-start/deferred-hydration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"solid-js": "^1.9.10"
},
"devDependencies": {
"@rsbuild/core": "^2.0.1",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-solid": "^1.1.1",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion e2e/vue-router/rspack-basic-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion e2e/vue-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.0.5",
"@rsbuild/plugin-vue": "^1.2.2",
"@rsbuild/plugin-vue-jsx": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/quickstart-rspack-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"tailwindcss": "^4.2.2"
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-plugin": "^1.168.14",
"@types/react": "^19.0.8",
Expand Down
2 changes: 1 addition & 1 deletion examples/solid/quickstart-rspack-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"tailwindcss": "^4.2.2"
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-solid": "^1.1.1",
"@tanstack/router-plugin": "^1.168.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
}
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@types/node": ">=20"
}
}
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
2 changes: 1 addition & 1 deletion packages/solid-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"pathe": "^2.0.3"
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@tanstack/router-utils": "workspace:*",
"@types/node": ">=20",
"vite": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/start-plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"zod": "^4.4.3"
},
"devDependencies": {
"@rsbuild/core": "^2.0.8",
"@rsbuild/core": "^2.0.11",
"@types/babel__code-frame": "^7.0.6",
"@types/babel__core": "^7.20.5",
"@types/node": ">=20",
Expand Down
Loading