Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Use SWC loader #29
Use SWC loader #29
Changes from 15 commits
0963dbf
4c682e8
0a17f28
bdeddc2
90d49e7
68c5126
658cb86
7ab6fb7
05051fb
a38fbcc
aa37020
4302084
747092d
be1282b
62febd2
23f9457
959ec56
571baa6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can either change this package or make a new one that makes this integration super easy.
https://github.com/shakacode/react-on-webpacker/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move React support back into Shakapacker? Seems that we should keep it the same for both babel and swc? However, now that I'm maintaining shakapacker, I don't mind having React support being supported by default.
rails/webpacker#3224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justin808 there's two parts to it - understanding jsx syntax and React transform. I think we can move the latter to a config but with the former relying on the filename it might need to stay.
I'll see how it handles non-React jsx files and adjust accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justin808 There's some weirdness with passing options to swc inline, for more details swc-project/swc#3374
This setup will work though regardless and I see no real reason not to support basic React config out of the box if we're not requiring any specific presets or plugins like
@babel/preset-react
. It "just" works so we might as well embrace it. We could drop the tsx/jsx setting here and move to the custom config but that will probably need to become a function that takes a filename to allow dynamic setting of jsx/tsx value (no idea why SWC just didn't settle for one setting 🤷 ).Still, I've removed the transform setting from the default config and added section to the docs on how might one add settings to match any settings they have in preset-react if they wish to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll iterate on this after the first release.
Maybe we can just be clear that SWC is experimental and the final API might change by the time 6.1.0 is released.