Skip to content

Commit 12dd8e9

Browse files
committed
fix(git): hydrate the Next dev server so pnpm dev connects
The static-export options (`output: 'export'`, a relative `assetPrefix`, `trailingSlash`) were applied unconditionally. In `next dev` a relative `assetPrefix` breaks the client runtime's chunk base, so the page never hydrates — no interactivity, and the RPC client never connects (stuck on "connecting…"). Gate those options to the production build via the config phase; the exported SPA is unchanged, and dev now hydrates and connects.
1 parent 224f4d0 commit 12dd8e9

1 file changed

Lines changed: 24 additions & 14 deletions

File tree

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
output: 'export',
4-
assetPrefix: '.',
5-
trailingSlash: true,
6-
images: { unoptimized: true },
7-
// The workspace tsconfig uses path aliases that point at devframe's
8-
// source so source-level edits HMR cleanly. Next.js's incremental TS
9-
// check can't follow workspace project references through those aliases
10-
// and ends up type-checking unrelated source. Defer typechecking to the
11-
// workspace's own `tsc -b` (`pnpm typecheck`), which honors references.
12-
typescript: { ignoreBuildErrors: true },
13-
}
1+
import { PHASE_DEVELOPMENT_SERVER } from 'next/constants.js'
142

15-
export default nextConfig
3+
/**
4+
* The static-export options (`output: 'export'`, a relative `assetPrefix`, and
5+
* `trailingSlash`) exist so `next build` emits a self-contained SPA that mounts
6+
* at any base. They are wrong for `next dev`: a relative `assetPrefix` breaks
7+
* the dev client runtime's chunk base, so the page never hydrates (no
8+
* interactivity, and the RPC client never connects). Apply them only for the
9+
* production build so `pnpm dev` hydrates normally.
10+
*
11+
* @type {(phase: string) => import('next').NextConfig}
12+
*/
13+
export default (phase) => {
14+
const isDev = phase === PHASE_DEVELOPMENT_SERVER
15+
return {
16+
...(isDev ? {} : { output: 'export', assetPrefix: '.', trailingSlash: true }),
17+
images: { unoptimized: true },
18+
// The workspace tsconfig uses path aliases that point at devframe's
19+
// source so source-level edits HMR cleanly. Next.js's incremental TS
20+
// check can't follow workspace project references through those aliases
21+
// and ends up type-checking unrelated source. Defer typechecking to the
22+
// workspace's own `tsc -b` (`pnpm typecheck`), which honors references.
23+
typescript: { ignoreBuildErrors: true },
24+
}
25+
}

0 commit comments

Comments
 (0)