-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[0.32,0.33] Browser field in package.json not working #9854
Comments
I'm seeing this problem too with https://github.com/philikon/ReactNativify |
To summarize this problem:
Without knowing too much of the internals of the packager, I think an elegant way to fix this would be to provide an empty module and return that instead of doing nothing in (3). Then the machinery in (4) simply does its normal thing, rewriting the Thoughts, @davidaurelio? |
Yeah, I guess the time to fix this has finally come :-P as @philikon suggested, doing the following should work:
If anybody wants to send a PR, just ping me on Messenger and I will shipit. I don’t always read github notifications. Otherwise I will do it tomorrow, London time. |
Thanks much for the fix, @davidaurelio! |
Summary: This adds support for `false` values in `package.json` `"browser"` and `"react-native"` mappings. All `false` values are not longer silently ignored, but redirected to an empty file. Fixes facebook#9854 facebook#9518 Reviewed By: bestander Differential Revision: D3876521 fbshipit-source-id: 96d1ba03518812bc88c51672c374956eabd40c9b
Summary: This adds support for `false` values in `package.json` `"browser"` and `"react-native"` mappings. All `false` values are not longer silently ignored, but redirected to an empty file. Fixes facebook#9854 facebook#9518 Reviewed By: bestander Differential Revision: D3876521 fbshipit-source-id: 96d1ba03518812bc88c51672c374956eabd40c9b
Summary: This adds support for `false` values in `package.json` `"browser"` and `"react-native"` mappings. All `false` values are not longer silently ignored, but redirected to an empty file. Fixes facebook#9854 facebook#9518 Reviewed By: bestander Differential Revision: D3876521 fbshipit-source-id: 96d1ba03518812bc88c51672c374956eabd40c9b
Issue Description
When using a module which implement
browser: {}
in theirpackage.json
, the corresponding module(s) specified in thepackage.json
will returnnull
(Ref 1 and Ref 2) instead of an empty object as per the spec. This then throws anUnknown module
error because the packager assumes that it didn't find a module when gettingnull
(Ref).I tracked the issue down to the new version of
node-haste
being used in React Native since the 0.32 version (cc @davidaurelio), but I'm not sure of how to fix it myself.Steps to Reproduce / Code Snippets
Import a package using the browser field in
package.json
to ignore modules. https://github.com/yahoo/intl-messageformat for example (Refpackage.json
and incriminating line)Expected Results
it should import an empty object instead of throwing an error.
Additional Information
The text was updated successfully, but these errors were encountered: