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

revert locale fallbacks in require, re-add react native aliasing #4232

Merged
merged 1 commit into from Oct 11, 2017

Conversation

maggiepint
Copy link
Member

This change reverts @ovangle's change from July to try a fallback try/catch for requiring locales. It maintains the change for react native of aliasing the require function. I pulled this change into webpack 2 and everything seems fine. In short, we appear to be able to mostly make everyone happy.

@maggiepint
Copy link
Member Author

Follow up PR to test webpack against builds coming soon.

@mattjohnsonpint
Copy link
Contributor

This passes my MCVE.

// want to undo that for lazy loaded locales
getSetGlobalLocale(oldLocale);
oldLocale = globalLocale._abbr;
var aliasedRequire = require;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it aliased?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't know why this makes metro-bundler work for React native, I just know that it does do that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not working for a lot people because some react native modules e.g. react-native-gifted-chat are referencing moment-with-locales.min.js i.e. the minified version. For some reason, the minified version does not seem to have the fix.

When I fixed the code in moment-with-locales.min.js using your approach of aliasing "require", 2.19.1 began to work for me.

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.

None yet

5 participants