Skip to content

Commit df05dcf

Browse files
brenelzclaude
andcommitted
fix: custom extensions compile under the native compiler — the native JSX transform received the raw module id while only the lazy/refresh passes used the borrowed-extension filename built for unknown extensions, so @dom-expressions/compiler rejected e.g. .mdx files with "Unknown file extension" (#297); the JSX transform now gets the same borrowed filename
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 519da14 commit df05dcf

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vite-plugin-solid': patch
3+
---
4+
5+
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.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin[] {
11041104

11051105
const result = await compiler.transformAsync(code, {
11061106
...solidOptions,
1107-
filename: id,
1107+
filename: nativeFilename,
11081108
sourceMap: true,
11091109
});
11101110
maps.push(result.map);

0 commit comments

Comments
 (0)