forked from vitejs/vite
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Describe the bug
i write a plugin transform markdown to jsx, the result include moduleType: 'jsx',but oxc not handle this result
minimal reproducible example
- markdown to jsx plugin
import type { Plugin } from 'vite';
export function mdToJsx(): Plugin {
return {
name: 'vite:md-to-jsx',
transform: {
order: 'pre',
filter: {
id: /\.md$/,
},
async handler(src: string) {
const code = `export default function MDContent() {
return <div>hello</div>
};`
return {
code,
moduleType: 'jsx',
};
},
},
};
}
- config rolldown-vite with
enableNativePlugin: true
, resolve extensions includes.md
andmdToJsx
plugin
import { defineConfig } from 'vite';
import { mdToJsx } from './plugins/md-to-jsx.mjs';
export default defineConfig({
experimental: {
enableNativePlugin: true,
},
oxc: {
include: /\.(m?ts|[jt]sx|md)$/,
},
resolve: {
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', '.md'],
},
plugins: [mdToJsx()],
});
Reproduction
Steps to reproduce
No response
System Info
System:
OS: Linux 6.15 Manjaro Linux
CPU: (16) x64 AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Memory: 17.43 GB / 29.15 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 24.4.1 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 11.4.2 - /usr/bin/npm
pnpm: 10.13.1 - /usr/bin/pnpm
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels