Skip to content

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

Merged
merged 3 commits into from
Jul 13, 2017
Merged

Add .jsx extension support #53

merged 3 commits into from
Jul 13, 2017

Conversation

bengummer
Copy link
Contributor

Fixes #51

@@ -3,223 +3,225 @@ import { clearCache } from './js';

describe('eval', () => {
Copy link
Contributor Author

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.

@@ -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;
Copy link
Contributor Author

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

Copy link
Member

@CompuIves CompuIves Jul 13, 2017

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.

Copy link
Member

@CompuIves CompuIves left a 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?

@@ -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;
Copy link
Member

@CompuIves CompuIves Jul 13, 2017

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.

@bengummer
Copy link
Contributor Author

Thanks for the feedback @CompuIves - I've reverted the regex and run the contributor task.

@CompuIves CompuIves merged commit 34ca3ce into codesandbox:master Jul 13, 2017
@CompuIves
Copy link
Member

Thanks a lot! I'll deploy it now.

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 this pull request may close these issues.

3 participants