Skip to content

fix: port solid-start route treeshake fixes (#2238, #2249) - #1

Merged
birkskyum merged 1 commit into
mainfrom
port-solid-start-2238-2249
Jul 30, 2026
Merged

birkskyum merged 1 commit into
mainfrom
port-solid-start-2238-2249

Conversation

@brenelz

@brenelz brenelz commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Ports two file-system-routing fixes that landed on solid-start main after routing moved to this package, so they were dropped in the main → upgrade-to-solid-2-beta merge. Reference implementations: solid-start #2249 and #2238.

Keep route module ids ending in a real extension (solid-start #2249)

toModuleId built ids like route.tsx?pick=default&pick=$css, which silently excludes route modules from any plugin whose filter is anchored on the file extension — a very common default, e.g. unplugin-macros' /\.[cm]?[jt]sx?$/ (solid-start #1918, #1374).

  • toPickId appends a &lang.<ext> marker (the Vue SFC convention, ?vue&type=script&lang.ts) so ids end in a real extension again.
  • sanitizeChunkFileName — the bundler's default sanitizer plus a pass that strips the ?pick=...&lang tail — is applied via the plugin's config() hook so route chunks keep their short file-based names (index-<hash>.js, not index.tsx_pick_default_pick__css_lang-<hash>.js). Applied top-level rather than per-environment so server chunk names stay clean too. Both helpers are exported from filesystem-routing/vite.

Don't strip TS namespace members from route files (solid-start #2238)

The tree-shake transform treated export statements inside TS namespace/module blocks as route exports and pruned them when they weren't in the pick list. Only module-level exports are route exports, so the visitor now skips any ExportNamedDeclaration whose parent isn't the Program.

Verification

  • 71/71 tests pass, including new coverage for toPickId, sanitizeChunkFileName, the &lang.<ext> id format in the virtual module/build inputs, and a namespace-member regression test.
  • Verified end-to-end against solid-start's upgrade-to-solid-2-beta branch (basic fixture, patched dist): dev + prod SSR of a TS-namespace route renders correctly, and client/server chunk names are clean.

Two patch changesets included. solid-start's 2.x branch will bump its dependency once this is released.

🤖 Generated with Claude Code

- keep route module ids ending in a real extension (`?pick=...&lang.<ext>`)
  so ecosystem plugins with extension-anchored filters match route modules
  (solid-start #2249, fixes solid-start #1918/#1374), and sanitize chunk
  file names so route chunks keep their file-based names
- don't strip TS namespace members from route files: `export` inside a
  namespace/module block is unrelated to the pick list (solid-start #2238)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@birkskyum
birkskyum merged commit c65d71a into main Jul 30, 2026
@ryansolid
ryansolid deleted the port-solid-start-2238-2249 branch August 7, 2026 20:38
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.

2 participants