Skip to content

fix: annotate non-JSX modules with lazy module URLs - #407

Merged
ryansolid merged 1 commit into
nextfrom
fix/issue-406-ts-lazy-module-url
Oct 9, 2026
Merged

ryansolid merged 1 commit into
nextfrom
fix/issue-406-ts-lazy-module-url

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Summary

  • On the non-JSX early return in transform(), after the existing primitive-names pass, also run transformLazyAsync, resolveLazyModuleUrls, and injectSsrModuleId. A routes.ts of lazy(() => import(...)) now gets a project-relative callsite module URL, and an SSR .ts/.js module gets export const $$moduleUrl.
  • Those three passes are not gated on sourceNames / namePrimitives / observe. .ts/.js (including .mjs/.cjs/.mts/.cts) stay off the JSX parser and off solid-refresh. "use server" stays in serverFunctions().
  • .d.ts is skipped. $$moduleUrl still is not stamped inside node_modules (injectSsrModuleId). Lazy still runs for a non-JSX script in node_modules when the source contains lazy, matching the JSX path.

Fixes #406

Test plan

  • pnpm exec tsc --noEmit and pnpm build
  • examples/ssr suite, including test/ts-module-url.mjs: with solid.sourceNames: false, a .ts callsite gets the project-relative module URL in dev and in a production build, an SSR .ts target gets $$moduleUrl, the client build does not, and a .d.ts is not stamped
  • examples/start-ssr production build still succeeds
  • CI

Made with Cursor

Plain .ts/.js files returned before the lazy pipeline, so a routes.ts callsite never got a module URL and an SSR target never got $$moduleUrl.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: af79dd8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@407

commit: af79dd8

@ryansolid
ryansolid merged commit 6053860 into next Oct 9, 2026
6 checks passed
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.

1 participant