-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add .jsx extension support #53
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
Add .jsx extension support #53
Conversation
@@ -3,223 +3,225 @@ import { clearCache } from './js'; | |||
|
|||
describe('eval', () => { |
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.
The changes in this file look big, but it's really just indented one level (because of the new forEach
loop) and using the loop's jsExtension
instead of static .js
.
src/sandbox/utils/resolve-module.js
Outdated
@@ -3,7 +3,7 @@ import type { Module, Directory } from 'common/types'; | |||
|
|||
const compareTitle = (original: string, test: string) => { | |||
if (original === test) return true; | |||
if (original === `${test}.js`) return true; | |||
if (original.match(new RegExp(`^${test}.jsx?$`))) return true; |
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.
Used RegExp here, but happy to switch back to ===
if you prefer
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, I'd prefer to let this still be a strict equal, since the case is not very dynamic and building Regexes can be quite expensive.
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.
This is reaaally great! Thanks a bunch, also really nice how you handle the tests. I left a very small comment, then it's ready to merge.
Could you add yourself to the contributors by running npm run add
?
src/sandbox/utils/resolve-module.js
Outdated
@@ -3,7 +3,7 @@ import type { Module, Directory } from 'common/types'; | |||
|
|||
const compareTitle = (original: string, test: string) => { | |||
if (original === test) return true; | |||
if (original === `${test}.js`) return true; | |||
if (original.match(new RegExp(`^${test}.jsx?$`))) return true; |
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, I'd prefer to let this still be a strict equal, since the case is not very dynamic and building Regexes can be quite expensive.
Thanks for the feedback @CompuIves - I've reverted the regex and run the contributor task. |
Thanks a lot! I'll deploy it now. |
Fixes #51