-
Notifications
You must be signed in to change notification settings - Fork 4.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
@wordpress/scripts to be able to transpile .jsx files in addition to .js files #21009
Comments
Hi @cliffordp. My understanding is that the Another consideration is that WordPress might consider a coding standard around file extensions to keep things consistent across projects. As this is a small change, it might be an idea to put together a PR with your proposal. |
I've chosen not to use wp/scripts for my build process, for other issues besides this, but if you want me to submit it, I surely will... just won't be dogfooding it. Let me know. |
We don’t use .jsx extension for files in both Gutenberg and WordPress core. It’s something that is totally optional for many projects and needs extra configuration. In practice, it’s something that might become a challenge at scale when you refactor and you end up having files that no longer contain JSX and it forces you to rename the file or what’s even worse you forget to do so. It’s just simpler for the wider group of people to have one extension supported. I would be in favor of keeping things as is. It would require changes not only for the build script but to bring consistency also for:
It’s something you can raise for the WordPress Core JS meeting that happens every week (check https://make.wordpress.org/meetings/#core for the exact date) to validate with the wider group. I might be in the minority. |
Actually, I did it already, see: There is a similar proposal for JS formatting opened by @a6software in #21151. |
Notes from the Core JS chat (https://make.wordpress.org/core/2020/04/06/javascript-chat-summary-march-31-2020/):
|
Closes #21009 based on the proposal from @cliffordp.
Given that this proposal aligns with other commands that already work with
I decided to open #28002 that implements it, mostly for consistency 😄 |
#28002) Closes #21009 based on the proposal from @cliffordp.
Is your feature request related to a problem? Please describe.
.jsx
files aren't processed by wordpress/scripts' webpack file, but.js
files are.Describe the solution you'd like
Is it as simple as changing https://github.com/WordPress/gutenberg/blob/v7.7.1/packages/scripts/config/webpack.config.js#L38
from:
test: /\.js$/,
to:
test: /\.jsx?$/,
Describe alternatives you've considered
I was playing around with this so much, I didn't isolate if the above code change would solve things, but it just might???
The text was updated successfully, but these errors were encountered: