Skip to content

fix: compile ids whose extension follows the query - #443

Open
lxsmnsyc wants to merge 1 commit into
nextfrom
fix/206-query-before-extension
Open

lxsmnsyc wants to merge 1 commit into
nextfrom
fix/206-query-before-extension

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Fixes #206 on next. The fix for main (1.x) is in a separate PR.

Icons from unplugin-icons with compiler: 'solid' and a query, such as ~icons/mdi/folder?width=2em, are compiled by Solid again. They were left to Vite's default JSX transform, which emits React code.

Cause

  • unplugin-icons puts the extension after the query: ~icons/mdi/folder?width=2em.tsx.
  • The plugin removes the query before it checks the extension, so it saw no JSX extension and skipped the module.

Changes

  • If the path without its query is not a JSX file but the full id is, the plugin compiles it.
  • getExtension now removes the query before it looks for the extension. Before, a custom extension followed by a query containing a ., such as a.mdx?x=1.5, was skipped.

Testing

  • Reproduced with an icon import that has a query. Vite 8 failed to build on react/jsx-dev-runtime, and the dev server returned 500. Published 2.11.1 compiled it correctly.
  • With the fix, the icon compiles to Solid output.
  • Added regression tests for both cases. They fail without the fix.
  • vitest run and tsc --noEmit pass. The vite-8, ssr and start-ssr examples build.

🤖 Generated with Claude Code

- The transform stripped the query before checking the extension. Ids like unplugin-icons' `~icons/mdi/folder?width=2em.tsx` then had no extension, so Vite compiled their JSX for React.
- When the query-free path is not a JSX file but the full id is, compile the full id.
- Read custom extensions from the query-free path. A dot in the query (`a.mdx?x=1.5`) was read as the extension and the module was skipped.
- Add dev transform tests for both cases.

Fixes #206

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e01a6b3

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 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: e01a6b3

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