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
2 changes: 1 addition & 1 deletion benchmarks/bundle-size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
"@rsbuild/core": "^2.0.11",
"@rsbuild/core": "^2.1.0",
"@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.11",
"@rsbuild/core": "^2.1.0",
"@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.11",
"@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-start/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.0.11",
"@rsbuild/core": "^2.1.0",
"@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/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.11",
"@rsbuild/core": "^2.1.0",
"@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.11",
"@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
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.11",
"@rsbuild/core": "^2.1.0",
"@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.11",
"@rsbuild/core": "^2.1.0",
"@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.11",
"@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
Expand Down
21 changes: 21 additions & 0 deletions e2e/react-start/rsbuild/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules
package-lock.json
yarn.lock

.DS_Store
.cache
.env
.vercel
.output

/build/
/api/
/server/build
/public/build
/dist/
/dist-rsbuild-*/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
port-*.txt
1 change: 1 addition & 0 deletions e2e/react-start/rsbuild/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.prettierrc
40 changes: 40 additions & 0 deletions e2e/react-start/rsbuild/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "tanstack-react-start-e2e-rsbuild",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"dev": "rsbuild dev",
"dev:e2e": "rsbuild dev --port $PORT",
"build": "rsbuild build && tsc --noEmit",
"start": "node server.js",
"test:e2e-full": "pnpm build && sh -c 'rm -f \"port-${E2E_PORT_KEY:-$npm_package_name}.txt\" \"port-${E2E_PORT_KEY:-$npm_package_name}-syntax-error-overlay.txt\"' && playwright test --project=chromium"
},
"nx": {
"metadata": {
"playwrightModes": [
{
"toolchain": "rsbuild",
"mode": "ssr"
}
]
}
},
"dependencies": {
"@tanstack/react-router": "workspace:^",
"@tanstack/react-start": "workspace:^",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"srvx": "^0.10.0",
"typescript": "^5.7.2"
}
}
29 changes: 29 additions & 0 deletions e2e/react-start/rsbuild/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fs from 'node:fs'
import { defineConfig, devices } from '@playwright/test'
import packageJson from './package.json' with { type: 'json' }

const e2ePortKey = process.env.E2E_PORT_KEY ?? packageJson.name

if (process.env.TEST_WORKER_INDEX === undefined) {
for (const portFile of [
`port-${e2ePortKey}.txt`,
`port-${e2ePortKey}-syntax-error-overlay.txt`,
]) {
fs.rmSync(portFile, { force: true })
}
}

export default defineConfig({
testDir: './tests',
workers: 1,
reporter: [['line']],

projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
},
},
],
})
14 changes: 14 additions & 0 deletions e2e/react-start/rsbuild/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'

const outDir = process.env.E2E_DIST_DIR ?? 'dist'

export default defineConfig({
plugins: [pluginReact({ splitChunks: false }), tanstackStart()],
output: {
distPath: {
root: outDir,
},
},
})
62 changes: 62 additions & 0 deletions e2e/react-start/rsbuild/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import fs from 'node:fs'
import path from 'node:path'
import { spawn } from 'node:child_process'
import { pathToFileURL } from 'node:url'

const distDir = process.env.E2E_DIST_DIR || 'dist'

function resolveDistClientDir() {
return path.resolve(distDir, 'client')
}

function resolveDistServerEntryPath() {
const serverJsPath = path.resolve(distDir, 'server', 'server.js')
if (fs.existsSync(serverJsPath)) {
return serverJsPath
}

const indexJsPath = path.resolve(distDir, 'server', 'index.js')
if (fs.existsSync(indexJsPath)) {
return indexJsPath
}

return serverJsPath
}

export function resolveStartCommand() {
const distClientDir = resolveDistClientDir()
const distServerEntryPath = resolveDistServerEntryPath()
return `srvx --prod -s ${JSON.stringify(distClientDir)} ${JSON.stringify(distServerEntryPath)}`
}

export function start() {
const child = spawn(
'srvx',
['--prod', '-s', resolveDistClientDir(), resolveDistServerEntryPath()],
{
stdio: 'inherit',
shell: process.platform === 'win32',
},
)

child.on('error', (error) => {
console.error('Failed to start srvx:', error)
process.exit(1)
})

child.on('exit', (code, signal) => {
if (signal) {
process.kill(process.pid, signal)
return
}

process.exit(code ?? 0)
})
Comment thread
SyMind marked this conversation as resolved.
}

if (
process.argv[1] &&
import.meta.url === pathToFileURL(process.argv[1]).href
) {
start()
}
68 changes: 68 additions & 0 deletions e2e/react-start/rsbuild/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* eslint-disable */

// @ts-nocheck

// noinspection JSUnusedGlobalSymbols

// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.

import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'

const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)

export interface FileRoutesByFullPath {
'/': typeof IndexRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/'
fileRoutesByTo: FileRoutesByTo
to: '/'
id: '__root__' | '/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
}

declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
}
}

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()

import type { getRouter } from './router.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
}
10 changes: 10 additions & 0 deletions e2e/react-start/rsbuild/src/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createRouter } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'

export function getRouter() {
return createRouter({
routeTree,
scrollRestoration: true,
defaultPreload: 'intent',
})
}
37 changes: 37 additions & 0 deletions e2e/react-start/rsbuild/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
HeadContent,
Outlet,
Scripts,
createRootRoute,
useHydrated,
} from '@tanstack/react-router'

export const Route = createRootRoute({
head: () => ({
meta: [
{ charSet: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ title: 'Rsbuild test' },
],
}),
component: RootComponent,
})

function RootComponent() {
const hydrated = useHydrated()

return (
<html>
<head>
<HeadContent />
</head>
<body>
<span data-testid="app-hydrated" style={{ display: 'none' }}>
{hydrated ? 'hydrated' : 'hydrating'}
</span>
<Outlet />
<Scripts />
</body>
</html>
)
}
14 changes: 14 additions & 0 deletions e2e/react-start/rsbuild/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/')({
component: Home,
})

function Home() {
return (
<main>
<h1>Rsbuild fixture</h1>
<p>Error overlay fixture</p>
</main>
)
}
Loading