-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support jsx automatic runtime #712
Comments
not yet. jsx in react use esbuild default that React.createElement。maybe add it to the configuration later。 const JsxPresets: Record<
string,
Pick<TransformOptions, 'jsxFactory' | 'jsxFragment'>
> = {
vue: { jsxFactory: 'jsx', jsxFragment: 'Fragment' },
preact: { jsxFactory: 'h', jsxFragment: 'Fragment' },
react: {} // use esbuild default
} |
This will have to depend on esbuild itself. |
I close this and wait evanw/esbuild#334 resloved, we will support it. |
esbuild has stated they are not directly supporting it. |
I think it'd be best to wait until this comment gets an answer. We could probably try appending the imports ourselves, not sure about identifier conflicts though. |
@yyx990803 New update on this: evanw/esbuild#334 (comment) esbuild won't support this OOTB, so Vite needs to maintain an esbuild plugin. |
That plugin is only for bundling with esbuild. Vite only uses esbuild to transpile J/TSX, not for bundling. So if esbuild is not going to natively support React 17 jsx transforms, people who want React 17 transform in Vite will need to disable esbuild in Vite and use a separate Vite plugin to transpile JSX files, similar to Alternatively, use |
I've published v1 of |
React 17 will be adding jsx automatic runtime. It's now available in the latest release candidate.
More info here.
Can vite support this? i.e. react/jsx-runtime and react/jsx-dev-runtime
Thanks!
The text was updated successfully, but these errors were encountered: