metro-bundler: fix jest-haste-map require

Summary:
Addresses https://github.com/facebook/metro-bundler/issues/62

Apparently with some versions of `jest-haste-map`, the nested source file returns the module wrapped with `default` instead of the exports themselves (due to some ES6 babel transform, I am guessing). I wasn't able to reproduce this myself yet, but I think a good first step is to avoid using nested library files in the first place, ie. only use what's exported at the top-level.

Reviewed By: rafeca

Differential Revision: D5890757

fbshipit-source-id: 1196264b5626eda65c4aae222db2a1620f901c55
This commit is contained in:
Jean Lauliac 2017-09-25 07:12:16 -07:00 committed by Facebook Github Bot
parent 3b6fddc746
commit c4f9ee5720
1 changed files with 1 additions and 3 deletions

View File

@ -20,9 +20,7 @@ const debug = require('debug')('Metro:DependencyGraph');
const isAbsolutePath = require('absolute-path');
const path = require('path');
const {
DuplicateHasteCandidatesError,
} = require('jest-haste-map/build/module_map');
const {DuplicateHasteCandidatesError} = require('jest-haste-map').ModuleMap;
import type DependencyGraphHelpers from './DependencyGraphHelpers';
import type ResolutionResponse from './ResolutionResponse';