Change bin/jsx default file extension to .jsx
See original GitHub issueCurrently, bin/jsx defaults to looking for .js
files to which contain jsx content to compile. Whilst it’s possible to override this using jsx -x jsx ...
, I think that since jsx content is not valid JavaScript, using the .js
extension by default isn’t ideal.
Could we change bin/jsx
to look for .jsx
files instead?
Another advantage to this is that the generated .js
files can live the same directory as the source .jsx
. This simplifies the generation of source maps files as well, because the path to the .jsx
is trivially relative to the generated .js
For example, given foo.jsx
, running jsx . .
would result in:
$ ls
foo.jsx
foo.js
foo.js.map
Issue Analytics
- State:
- Created 10 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Change language to JSX in Visual Studio Code - Stack Overflow
I'm in a project with a lot of .js files with JSX and I can't change it. Is there any other way to...
Read more >Introducing JSX - React
It is called JSX, and it is a syntax extension to JavaScript. We recommend using it with React to describe what the UI...
Read more >Evan You on Twitter: "The reason Vite requires .jsx extension ...
The reason Vite requires .jsx extension for JSX processing is because in most cases plain .js files shouldn't need full AST transforms to ......
Read more >React | WebStorm Documentation - JetBrains
To change the default setting, open the Settings/Preferences ... and clear the Convert attributes when pasting HTML to JSX files checkbox.
Read more >Why is the jsx extension so rarely used for React components?
js file. By default VSCode uses "babel javascript" for .js files, so I changed my files to .jsx and changed the setting to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Agreed on all points above. I’ll add that using
.jsx
instead of.js
tips off your editor to highlight correctly.We’re deprecating react-tools so closing out.