Skip to content

Commit af2b0bf

Browse files
Updated packages and moved to the handler
1 parent a36b93f commit af2b0bf

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/stats-generator/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"type-check": "tsc --noEmit"
2020
},
2121
"dependencies": {
22-
"react-router": "7.13.2",
2322
"react": "19.2.4",
2423
"react-dom": "19.2.4",
2524
"lighthouse": "^12.0.0",

packages/stats-generator/src/ssr/handlers/react-router.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { join } from 'node:path'
22
import { pathToFileURL } from 'node:url'
3-
import { createRequestHandler } from 'react-router'
43
import { packagesDir } from '../../constants.ts'
54
import type { SSRHandler } from '../types.ts'
65

76
export async function buildReactRouterHandler(): Promise<SSRHandler> {
8-
const buildPath = join(
9-
packagesDir,
10-
'app-react-router',
11-
'build',
12-
'server',
13-
'index.js',
14-
)
7+
const appDir = join(packagesDir, 'app-react-router')
8+
const buildPath = join(appDir, 'build', 'server', 'index.js')
159
const buildUrl = pathToFileURL(buildPath).href
10+
11+
const rrUrl = import.meta.resolve(
12+
'react-router',
13+
pathToFileURL(join(appDir, 'package.json')).href,
14+
)
15+
const { createRequestHandler } = await import(rrUrl)
1616
const build = await import(buildUrl)
17+
1718
return {
1819
type: 'web',
1920
handler: createRequestHandler(build, 'production'),

0 commit comments

Comments
 (0)