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

react-native packager(or to be more precise - jest-haste-map) module resolution issue with 3rd party lib. #14053

Closed
nixoz opened this issue May 19, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@nixoz
Copy link

nixoz commented May 19, 2017

Description

If react-native and react-native-windows installed together - the modules from latter considered being generic(g) by the packager(jest-haste-map). As result, we have broken app.

the initial discussion was started here: #13925

Reproduction Steps and Sample Code

  1. react-native init test
  2. cd test && yarn add react-native-windows
  3. in the generated index.ios.js make a small modification so the render method of default exported component will look like that:
render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          <Text style={styles.instructions}>
            To get started, edit index.ios.js
          </Text>
        </Text>
      </View>
    );
  }
  1. react-native run-ios
  2. ㅠㅠ

2017-05-19 16 10 22

Solution

During investigating this, read a lot of code and eventually come to jest-haste-map - the one which required by react-native.

In the react-native packager defaults.js here is platforms array exported, looks like dat:

exports.platforms = ['ios', 'android', 'windows', 'web'];

at the same time, in jest-haste-map's lib/getPlatformExtension.js we have:

const SUPPORTED_PLATFORM_EXTS = {
  android: true,
  ios: true,
  native: true,
  web: true };

adding windows: true, to SUPPORTED_PLATFORM_EXTS dict will give us a fix:

2017-05-19 16 30 54

Should I make a PR to jest-haste-map? or this thing was already addressed?
UPD: just in case, PR is below

Additional Information

  • React Native version: 0.44
  • Platform: iOS 10.0/10.3
  • Development Operating System: macOSX 10.12.4(16E195)
  • Dev tools: Xcode Version 8.3.2 (8E2002) / Simulator Version 10.0 (SimulatorApp-745.10
@nixoz nixoz changed the title react-native packager(jest-haste-map) module resolution issue with 3rd party lib. react-native packager(or to be more precise - jest-haste-map) module resolution issue with 3rd party lib. May 19, 2017
@skevy
Copy link
Contributor

skevy commented Jun 8, 2017

Hi there!

The packager no longer lives in this repo. It now lives in https://github.com/facebook/metro-bundler. The reasoning for the split is explained here: #13976.

If you're still interested in pursuing this issue, please open an issue on that repo! :)

Thanks!
-Adam

@skevy skevy closed this as completed Jun 8, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Jun 8, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants