Skip to content
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

JSX build tool documentation #2943

Closed
dcposch opened this issue Jan 26, 2015 · 3 comments · Fixed by #2997
Closed

JSX build tool documentation #2943

dcposch opened this issue Jan 26, 2015 · 3 comments · Fixed by #2997

Comments

@dcposch
Copy link

dcposch commented Jan 26, 2015

I ran into an issue where the jsx command-line build tool wouldn't build a folder full of .jsx files.

$ jsx --help
    Usage: jsx [options] <source directory> <output directory> [<module ID> [<module ID> ...]]
    [...]
$ ls src
App.jsx  Inbox.jsx  Login.jsx
$ jsx src/ build/js/
[]

You get cryptic output (empty array) and nothing happens. This caused me an hour or two of confusion, and I tried checking the docs and eventually just read the source for jsx, saw it uses commoner, and found out from further digging:

Turns out jsx requires the input files to have a .js extension (rather than .jsx).

I think it might help people to put a short section in the docs on how to integrate jsx into your build.

In short, and correct me if I'm wrong:

  • JSX files should be end in .js, not in .jsx
  • Use jsx src/ dst/ to compile a folder full of JSX files to plain JS
  • The /** @jsx React.DOM */ comment is no longer required and has no effect
  • If you're using Browserify, you don't have to use jsx at all, just use --reactify

Thoughts?

@dcposch
Copy link
Author

dcposch commented Jan 26, 2015

Looks like you can also use -x, for example

 jsx -x jsx src/ dst/

...to handle files that end in .jsx. From the Quick Start, it looks like the new standard is to just use .js though.

@jimfb
Copy link
Contributor

jimfb commented Jan 27, 2015

Would probably be a good idea to add a info/notice/warning if the transpiler notices some .jsx files but isn't converting them, since a user probably intended to have the devtools convert their jsx files. #goodfirstbug

PS: Hey DC! Glad to see you're using React! We should go do the dish run again some time, I'd be curious to hear how your web-based gpg client is going!

@dcposch
Copy link
Author

dcposch commented Jan 27, 2015

Sure, I'm down!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants