-
-
Notifications
You must be signed in to change notification settings - Fork 106
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 React's new JSX transform #184
Comments
Evan means esbuild plugins, not just any plugin. esbuild-loader uses esbuild's transform API, which doesn't support esbuild plugins. If you want to omit the React import, you can use Webpack's Provide Plugin. Closing since this feature request belongs in esbuild rather than esbuild-loader. |
For any people who want to copy and paste the solution: plugins: [
new webpack.ProvidePlugin({
React: 'react',
}),
], |
esbuild implemented automatic JSX transform in 0.14.51 https://github.com/evanw/esbuild/blob/master/CHANGELOG.md#01451 Maybe reopen this? |
Why does it need to be reopened if it's been implemented? |
I assumed that esbuild-loader must implement something in order to pass that new option to esbuild. Maybe this is not the case and the current implementation can already be used. If this is the case, how can I pass that option? |
Nevermind, I found it. For anyone that might get here from google search, this is the config:
Using this new option renders this unnecessary:
@privatenumber Maybe this section of the docs should be updated in order to reflect this. |
I'm on version
Trying to use
|
Make sure you're using the latest esbuild via https://github.com/privatenumber/esbuild-loader/#bring-your-own-esbuild-advanced |
Thank you @privatenumber, that worked. Apologies for missing what was already in the docs! |
This comment was marked as resolved.
This comment was marked as resolved.
Can you elaborate? The latest comment in the thread you referenced says |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as spam.
This comment was marked as spam.
What are you referring to as the old & new JSX transforms? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I just wanted to ensure we're on the same page regarding the old and new JSX transforms, as you seem quite confident about esbuild not supporting a feature that many others claim it does. Using the same input from the React blog, you can verify esbuild outputs the new transform. If you still have concerns or encounter issues with this feature, I would recommend discussing them directly on the relevant GitHub issue: evanw/esbuild#334. |
This comment was marked as off-topic.
This comment was marked as off-topic.
If it doesn't work you can file a bug with a demonstration that it's not working. Locking this thread as the original issue has been resolved, and the rest are all debugging help. If you need help, post in Discussions instead. |
Feature request
React 17 came with a new JSX transform feature which allow user to omit
import React from 'react'
from components. This feature has also been added back intov16
,v15
andv0.14
then.I moved from
ts-loader
toesbuild-loader
for its performance. But when I want to use the new JSX transform I notice that esbuild has not supported yet while TypeScript 4.1 already supports it.Why?
evanw suggested a plugin approach, and I believe this loader is a good place for doing it.
Alternatives
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: