Skip to content

Commit 6acb976

Browse files
committed
fix(html): move router constants to ui/constants.mjs; keep node: imports out of browser bundle
constants.mjs imports node:path and node:url, which break when bundled for the browser. The ROUTER_* constants added in da720ce pulled those Node.js builtins into the client bundle, silently preventing startRouter from loading and causing every client-side navigation to fall back to a full page reload. Move the constants to packages/react/src/html/ui/constants.mjs (browser-only code) and remove their exports from the Node.js-side constants.mjs. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent feb4a6e commit 6acb976

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

‎packages/react/src/html/constants.mjs‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,3 @@ export const FONTS = [
9292
'open-sans-latin-wght-italic.woff2',
9393
'ibm-plex-mono-latin-400-normal.woff2',
9494
];
95-
96-
// How long a hovered link waits before its page is prefetched.
97-
export const ROUTER_HOVER_DELAY = 80;
98-
99-
// How long a fetched page is reused for, whether prefetched or visited.
100-
export const ROUTER_PAGE_LIFETIME = 5 * 60 * 1000;
101-
102-
// How many fetched pages are kept at once.
103-
export const ROUTER_MAX_PAGES = 10;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// How long a hovered link waits before its page is prefetched.
2+
export const ROUTER_HOVER_DELAY = 80;
3+
4+
// How long a fetched page is reused for, whether prefetched or visited.
5+
export const ROUTER_PAGE_LIFETIME = 5 * 60 * 1000;
6+
7+
// How many fetched pages are kept at once.
8+
export const ROUTER_MAX_PAGES = 10;

‎packages/react/src/html/ui/router.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
ROUTER_HOVER_DELAY,
2323
ROUTER_MAX_PAGES,
2424
ROUTER_PAGE_LIFETIME,
25-
} from '../constants.mjs';
25+
} from './constants.mjs';
2626
import { fetchPage, parsePage, showPage, transition } from './page.mjs';
2727

2828
/**

0 commit comments

Comments
 (0)