-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Adds JSX extension support #563
Conversation
@@ -74,7 +74,7 @@ module.exports = { | |||
// https://github.com/facebookincubator/create-react-app/issues/253 | |||
fallback: paths.nodePaths, | |||
// These are the reasonable defaults supported by the Node ecosystem. | |||
extensions: ['.js', '.json', ''], | |||
extensions: ['.jsx', '.js', '.json', ''], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it the last extension before "", not the first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how about after .js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer Node resolution mechanism to be respected before falling back to JSX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok makes sense.
@gaearon ok, updated. FWIW, I think adding JSX support is the right direction 👍 |
👍 Can you please include a test plan? |
@gaearon for testing, I created a If you think a JSX example in templates would be helpful, I can create something like |
It is slightly confusing that testRegex: '(/__tests__/.*|\\.(test|spec))\\.(js|jsx)$', Perhaps worth making a default in Jest if we proceed with this. |
@@ -74,7 +74,8 @@ module.exports = { | |||
// https://github.com/facebookincubator/create-react-app/issues/253 | |||
fallback: paths.nodePaths, | |||
// These are the reasonable defaults supported by the Node ecosystem. | |||
extensions: ['.js', '.json', ''], | |||
// We also include JSX as a common component filename extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would specifically add that we don’t recommend using it but some tools rely on it, and link to the issue.
Good catch on the |
Since we’re doing it for the sake of more stubborn tooling, seems like it’s best to be fully consistent. |
Thanks! |
* Adds JSX extension support * PR changes * Add testRegex * Add note about not recommending JSX, link to issue
* Adds JSX extension support * PR changes * Add testRegex * Add note about not recommending JSX, link to issue
Adds JSX file support.
Connects to #290