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

getting-started.md jsx --watch doesn't work #4269

Closed
amitmtrn opened this issue Jul 2, 2015 · 4 comments
Closed

getting-started.md jsx --watch doesn't work #4269

amitmtrn opened this issue Jul 2, 2015 · 4 comments

Comments

@amitmtrn
Copy link

amitmtrn commented Jul 2, 2015

The cli command jsx --watch src/ build/ doesn't work in windows.

after digging for a while i've found:
http://stackoverflow.com/questions/22739672/react-jsx-watch-does-nothing-after-first-conversion

tried:

jsx --watch -x jsx src/ build/

and everything works fine now.
Is it doc problem or I miss something in the cli?

I'm running on:

  • windows 7
  • node v0.10.33
  • npm 1.4.28
  • react-tools 0.13.3
@jimfb
Copy link
Contributor

jimfb commented Jul 2, 2015

Do your files have a .jsx suffix or a .js suffix? The command in the docs (getting-started.md) correctly states that it will translate the .js file. It says nothing about .jsx files. Am I correct in assuming that's the problem?

@amitmtrn
Copy link
Author

amitmtrn commented Jul 2, 2015

@jimfb that's right, didn't notice the suffix in the example (problem solved) but,
why is the default suffix is .js? if I write html inside the .js it's not a valid javascript file.
I think that it should be changed to .jsx as default.

@jimfb
Copy link
Contributor

jimfb commented Jul 2, 2015

@amitmtrn Yeah, Sebastian wrote a long rant about this somewhere. Basically, it's a side effect of the fact that using transforms is now a fairly standard thing to do in javascript. For instance, if you're using es6 classes, you have to use a transform, but that's technically part of the javascript language now. What if you're using es7 features? What if you are using speculative features that haven't reached consensus at TC39? What if you are using multiple language extensions? mycomponent.es6.jsx.flow.sweetjs.whatever? How do you decide on the order of the suffixes? It starts to become a mess. Since transformations are a part of the javascript build/deploy process nowadays, and are here to stay, the decision was made to just call everything javascript.

@jimfb
Copy link
Contributor

jimfb commented Jul 2, 2015

Update: I found Sebastian's original post I was talking about: #3582 (comment) (it wasn't as long as I remembered it being)

On another note, I think the jsx command is provided by react-tools, which is being sunsetted in favor of transforms like Babel which have jsx support built in. See: facebookarchive/jstransform#81

For these reasons, I'm going to go ahead and close this issue.

@jimfb jimfb closed this as completed Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants