Skip to content

fix: don't require @funstack/router for apps without file-system routing - #204

Merged
uhyo merged 2 commits into
masterfrom
claude/zen-planck-2ta2a0
Nov 19, 2026
Merged

uhyo merged 2 commits into
masterfrom
claude/zen-planck-2ta2a0

Conversation

@uhyo

@uhyo uhyo commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Fixes #203

Problem

Since 1.3.2, #rsc-client (src/rsc-client/entry.ts) re-exported FsRouteSlot, which imports @funstack/router. Every app loads that entry, including apps that don't use file-system routing. When the optional @funstack/router peer dependency isn't installed:

  • the dev server crashes on the first GET request
  • vite build fails with MISSING_EXPORT

Fix

  • Move FsRouteSlot to a new "use client" entry, src/entries/rsc-client-fs-routes.ts, exposed as the #rsc-client/fs-routes subpath import.
  • #rsc-client now exports only RegistryContext and DeferredComponent.
  • Only the file-system routing code (src/fs-routes/entries.tsx) imports #rsc-client/fs-routes, so apps that don't use it never load the router.

Regression test

New e2e fixture e2e/fixture-no-router: an SSR app with a client component and defer() that doesn't install @funstack/router. It runs in both the build (no-router, port 4183) and dev server (no-router-dev, port 4184) projects.

Leaving the router out of the fixture's package.json isn't enough by itself. Within the workspace, the symlinked @funstack/static still resolves the router from its own devDependencies. That's why the existing e2e/fixture, which also doesn't list the router, passed CI with the bug present. So the fixture's Vite config includes a small plugin that makes @funstack/router unresolvable, as in an app that never installed it.

I also tried a pnpm injected dependency to get a real install. pnpm still linked the optional router peer into the injected copy, even with dedupeInjectedDeps: false and dedupePeerDependents: false. The copy would also need re-syncing after every build of @funstack/static.

Verification

  • With the old re-export restored, both new projects fail. The build stops on the unresolvable @funstack/router import, and the dev server returns an internal server error.
  • With the fix, all e2e tests pass: build 65/65, dev 42/42. The new dev test also passed 5/5 when repeated.
  • Typecheck, lint, format check and unit tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KZB12ayvFAT9YQxFuKiEPX

Since 1.3.2, `#rsc-client` re-exported `FsRouteSlot`, which imports
`@funstack/router`. That entry is loaded by every app, so apps without the
optional router peer dependency crashed the dev server and failed the
production build with MISSING_EXPORT.

Move `FsRouteSlot` to a separate `#rsc-client/fs-routes` client entry that
only the file-system routing code imports, and add a test that keeps
`#rsc-client` free of `@funstack/router` imports.

Fixes #203

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZB12ayvFAT9YQxFuKiEPX
Replace the import-graph unit test with an e2e fixture that does not
install the optional `@funstack/router` peer dependency, run against both
the production build and the dev server.

Within the workspace, the symlinked `@funstack/static` would still find
the router in its own devDependencies, so the fixture's Vite config makes
`@funstack/router` unresolvable, as in an app that never installed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZB12ayvFAT9YQxFuKiEPX
@uhyo
uhyo merged commit 2bb12c1 into master Nov 19, 2026
2 checks passed
@uhyo
uhyo deleted the claude/zen-planck-2ta2a0 branch November 19, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 1.3.2以降、@funstack/router のインストールが事実上必須化されています

2 participants