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 overwrites modules without --relativize #131

Closed
petehunt opened this issue Jun 27, 2013 · 1 comment · Fixed by #145
Closed

jsx overwrites modules without --relativize #131

petehunt opened this issue Jun 27, 2013 · 1 comment · Fixed by #145
Assignees

Comments

@petehunt
Copy link
Contributor

I encountered this issue when demoing to airbnb today.

Steps to repro:

  • create src/ dir
  • create regular js module src/React.js containing module.exports = 7; and src/Component.jsx which contains require('./React')
  • run: jsx -x jsx src/ src/ to build .js files alongside .jsx (a very common use case of this tool)
  • Observe React.js gets overwritten with a file that throws an exception

This manifests itself as: any time you pass something to -x that is not js, if you require React (which are js files) it will get overwritten.

This is very confusing. I think we really need to turn all of the magic off in this tool unless --relativize is provided. That includes debranching __DEV__, relativizing module names, and this sort of thing. That is, only the JSX desugaring should happen.

@ghost ghost assigned benjamn Jun 27, 2013
@petehunt
Copy link
Contributor Author

@benjamn and I came up with a game plan on IRC; we'll be opening more specific actionable issues moving forward.

benjamn added a commit to benjamn/react that referenced this issue Jul 1, 2013
If you are using bin/jsx independently, you may need to pass
--follow-requires to it if you rely on its dependency scanning.

Dependency scanning is still a good idea, but it's difficult to make it
work perfectly for everyone the first time they try bin/jsx.

Closes facebook#131.
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

Successfully merging a pull request may close this issue.

2 participants