You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add "include" and "exclude" option to @vitejs/plugin-react-swc #486
Yes we should add this for parity. Is there any reason apart from speed to use swc? The OXC plugin (not well tested yet) has the include/exclude options and will provide more speed when used with rolldown-vite
Sorry I totally forgot about this but you can use the parserConfig option like this:
react({parserConfig(id){if(id.endsWith('.tsx')&&!id.endsWith('.solid.tsx'))return{syntax: 'typescript',tsx: true}if(id.endsWith('.ts'))return{syntax: 'typescript',tsx: false}// all other files are ignored, so this assume you don't have JS(X) source files},})
An include/exclude option would be better here, but it can be tricky because if we add default this could break people depending on every id being sent to this function. The current state of the SWC plugin is not rolldown friendly at all. Maybe we should do a new major once Rolldown is the default for people that require some specific SWC plugins not available on OXC
Activity
ArnaudBarre commentedon May 30, 2025
Yes we should add this for parity. Is there any reason apart from speed to use swc? The OXC plugin (not well tested yet) has the include/exclude options and will provide more speed when used with rolldown-vite
fabian-hiller commentedon May 31, 2025
It's a bigger project that where already using SWC. Speed is probably the main reason. In the long run we will look into OXC.
ArnaudBarre commentedon Aug 30, 2025
Sorry I totally forgot about this but you can use the parserConfig option like this:
An include/exclude option would be better here, but it can be tricky because if we add default this could break people depending on every id being sent to this function. The current state of the SWC plugin is not rolldown friendly at all. Maybe we should do a new major once Rolldown is the default for people that require some specific SWC plugins not available on OXC