-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
new JSX transformer not supported #7
Comments
Looks like it's not supported by esbuild for now, see: evanw/esbuild#334 |
Maybe if we can use the --inject option (evanw/esbuild#334 (comment)) with this plugin, it could work? |
Maybe we can make this work with this option yes, just wondering how it will behave if you have mixed files with existing imports or non-existing imports. |
A way to do it could be to use this approach to inject React https://medium.com/react-weekly/never-import-react-from-react-again-thanks-to-webpack-s-provideplugin-69e7feb69e#.d5netgw5a |
@pradel - Would this also work with mixed files as you said? |
@vviikk Good question, I guess we will have to try to get an answer ahah. If it's not then, enabling this functionality under a flag can be a temporary option until we find a better way. We could also recommend to the user to set an eslint rule that would throw if you import react or something like this. |
Hi there! I encountered the issue const CracoEsbuildPlugin = require('craco-esbuild');
const { ProvidePlugin } = require('webpack');
module.exports = {
webpack: {
plugins: [
new ProvidePlugin({
React: 'react',
})
]
},
plugins: [
{ plugin: CracoEsbuildPlugin }
]
}; And now it works 👌 |
@pradel are there any plans to support this officially? This config seems to be working for us for now. Also thank you for maintaining this library! |
Using this is a workaround and is not actually using the new JSX transformer from my understanding. Before closing this one we should wait for evanw/esbuild#2349 to be merged in esbuild. |
Hey, so what's the status of the issue? The related fix was merged to I am asking, because I am having a problem with tests - while the build passes successfully, |
@pradel any updates here? |
Basically, the new JSX transformer is not supported (it is not required to import React from react anymore)
So we have this error:
ReferenceError: React is not defined
Reference:
https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
Probably related to #6
The text was updated successfully, but these errors were encountered: