From df05dcf9c839037855892fa579787a7e5d353294 Mon Sep 17 00:00:00 2001 From: Brenley Dueck Date: Mon, 10 Aug 2026 22:26:10 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20custom=20extensions=20compile=20under=20?= =?UTF-8?q?the=20native=20compiler=20=E2=80=94=20the=20native=20JSX=20tran?= =?UTF-8?q?sform=20received=20the=20raw=20module=20id=20while=20only=20the?= =?UTF-8?q?=20lazy/refresh=20passes=20used=20the=20borrowed-extension=20fi?= =?UTF-8?q?lename=20built=20for=20unknown=20extensions,=20so=20@dom-expres?= =?UTF-8?q?sions/compiler=20rejected=20e.g.=20.mdx=20files=20with=20"Unkno?= =?UTF-8?q?wn=20file=20extension"=20(#297);=20the=20JSX=20transform=20now?= =?UTF-8?q?=20gets=20the=20same=20borrowed=20filename?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .changeset/native-compiler-custom-extensions.md | 5 +++++ src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/native-compiler-custom-extensions.md diff --git a/.changeset/native-compiler-custom-extensions.md b/.changeset/native-compiler-custom-extensions.md new file mode 100644 index 0000000..46170f9 --- /dev/null +++ b/.changeset/native-compiler-custom-extensions.md @@ -0,0 +1,5 @@ +--- +'vite-plugin-solid': patch +--- + +Custom `extensions` work with the native compiler again. The native compiler picks its parser dialect from the file extension, so the transform builds a borrowed-extension filename (`foo.mdx` → `foo.mdx.jsx`, or `.tsx` when the extension is registered as TypeScript) for exactly this case — but only the lazy and refresh passes used it; the JSX transform itself still received the raw id, and `@dom-expressions/compiler` rejected it with "Unknown file extension" (#297). `compiler: 'babel'` was unaffected because that path names the parser plugins explicitly. The JSX transform now receives the same borrowed filename as the other native passes. diff --git a/src/index.ts b/src/index.ts index aa77d09..fab47b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1104,7 +1104,7 @@ export default function solidPlugin(options: Partial = {}): Plugin[] { const result = await compiler.transformAsync(code, { ...solidOptions, - filename: id, + filename: nativeFilename, sourceMap: true, }); maps.push(result.map);