Skip to content

Commit 7a583da

Browse files
chore: fix startup script
1 parent 3a80e6e commit 7a583da

File tree

4 files changed

+265
-7
lines changed

4 files changed

+265
-7
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Patch for handling CJS output from the build
2+
const app = require('./build/server/static/js/app.js');
3+
4+
// Export all the top-level keys needed by react-router-serve
5+
const {
6+
assets,
7+
assetsBuildDirectory,
8+
basename,
9+
entry,
10+
future,
11+
isSpaMode,
12+
prerender,
13+
publicPath,
14+
routes,
15+
ssr
16+
} = app;
17+
18+
// Export each property individually
19+
exports.assets = assets;
20+
exports.assetsBuildDirectory = assetsBuildDirectory;
21+
exports.basename = basename;
22+
exports.entry = entry;
23+
exports.future = future;
24+
exports.isSpaMode = isSpaMode;
25+
exports.prerender = prerender;
26+
exports.publicPath = publicPath;
27+
exports.routes = routes;
28+
exports.ssr = ssr;

examples/default-template/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"build": "rsbuild build",
77
"dev": "rsbuild dev",
8-
"start": "react-router-serve ./build/server/index.js",
8+
"start:esm": "react-router-serve ./build/server/static/js/app.js",
9+
"start:cjs": "react-router-serve ./cjs-serve-patch.cjs",
910
"typecheck": "react-router typegen && tsc",
1011
"test:e2e": "pnpm run dev & sleep 5 && playwright test",
1112
"test:e2e:debug": "playwright test --debug",

0 commit comments

Comments
 (0)