Replies: 1 comment
-
In two minds about this. On one hand, it would it would bring it closer to other loaders and follow similar thing to TS or SASS - config is there and you just need to install the package. Still, esbuild and SWC do support it without additional package (like preset-react) so it makes sense for it to be there. Having the support there also makes things bit easier - both SWC and esbuild need to have different loader flag based on whether the file is tsx, jsx, ts or js. It's non obvious how to get this going so opted to take care of this problem for users. The drawback is, some people still use react without jsx/tsx extensions but that's not supported here - I'm enforcing convention on you (although don't think anything would happen if we're enabled jsx for JS files and tsx for TS files, that's essentially what we end up with babel). Also, if we bring in the default for preset-react it makes it harder to configure additional options - you're not just adding new preset - you have to find the current one, merge the options etc Bit of a pain and don't think it's easy to do this in a backwards compatible manner. All in all, I would veer towards getting https://github.com/shakacode/react-on-webpacker tested and ready and perhaps offering similar options for SWC and esbuild to streamline the config. If we get the latter right, we could make jsx non default for both to align all loaders. |
Beta Was this translation helpful? Give feedback.
-
I had previously moved React support to docs in rails/webpacker#3224.
Given that esbuild and swc will support JSX by default, maybe the babel config should be moved back?
I'm also working on https://github.com/shakacode/react-on-webpacker/ which could make that configuration easier.
Beta Was this translation helpful? Give feedback.
All reactions