Repository navigation
fix: don't require @funstack/router for apps without file-system routing - #204
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #203
Problem
Since 1.3.2,
#rsc-client(src/rsc-client/entry.ts) re-exportedFsRouteSlot, which imports@funstack/router. Every app loads that entry, including apps that don't use file-system routing. When the optional@funstack/routerpeer dependency isn't installed:vite buildfails withMISSING_EXPORTFix
FsRouteSlotto a new"use client"entry,src/entries/rsc-client-fs-routes.ts, exposed as the#rsc-client/fs-routessubpath import.#rsc-clientnow exports onlyRegistryContextandDeferredComponent.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 anddefer()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.jsonisn't enough by itself. Within the workspace, the symlinked@funstack/staticstill resolves the router from its own devDependencies. That's why the existinge2e/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/routerunresolvable, as in an app that never installed it.I also tried a pnpm
injecteddependency to get a real install. pnpm still linked the optional router peer into the injected copy, even withdedupeInjectedDeps: falseanddedupePeerDependents: false. The copy would also need re-syncing after every build of@funstack/static.Verification
@funstack/routerimport, and the dev server returns an internal server error.🤖 Generated with Claude Code
https://claude.ai/code/session_01KZB12ayvFAT9YQxFuKiEPX