question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change bin/jsx default file extension to .jsx

See original GitHub issue

Currently, 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:closed
  • Created 10 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
turadgcommented, Nov 20, 2014

Agreed on all points above. I’ll add that using .jsx instead of .js tips off your editor to highlight correctly.

0reactions
zpaocommented, Jul 28, 2015

We’re deprecating react-tools so closing out.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found