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

Allow react-native-macos package.json shims #145

Merged
merged 1 commit into from
Feb 11, 2017
Merged

Conversation

c-h-
Copy link
Contributor

@c-h- c-h- commented Feb 11, 2017

This commit makes it possible to share code more broadly between react native platforms. For example, take the following package.json field:

package.json

"react-native-macos": { "react-native": "react-native-macos" }

With this set our components can import from react-native rather than react-native-macos, allowing code sharing between react native platforms more easily.

Having the ability to use the same imports across platforms is incredibly important. Using the browser or react-native fields of package.json is the accepted way by the community to shim global requires (it's the only way that the React packager accepts shims). The React Native Web project uses a webpack alias to make it possible to use React Native code to target the web without modification.

The new react-native-macos field in package.json that functions the same way as react-native to shim one-level deep requires/imports. See facebook/react-native#5917 for details of browser and react-native fields.

I've tested this locally myself and it works fine. I've tried to keep the same rules in this commit, simply adding react native macos as the highest precedence for shimming.

This commit makes it possible to add a `react-native-macos` field to package.json that functions the same way as `react-native` to shim one-level deep requires/imports. See facebook/react-native#5917 for details of `browser` and `react-native fields`.

This commit makes it possible to share code more broadly between react native platforms. For example, take the following package.json field:
```
"react-native-macos": { "react-native": "react-native-macos" }
```
With this set our components can import from react-native rather than react-native-macos, allowing code sharing between react native platforms more easily.
@ptmt ptmt merged commit 8c1a2b8 into ptmt:master Feb 11, 2017
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.

2 participants