From c4f9ee572071dcb929678f2805b427d5f8387f67 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Mon, 25 Sep 2017 07:12:16 -0700 Subject: [PATCH] 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 --- .../src/node-haste/DependencyGraph/ResolutionRequest.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js b/packages/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js index a303c6ea..27c32e13 100644 --- a/packages/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js +++ b/packages/metro-bundler/src/node-haste/DependencyGraph/ResolutionRequest.js @@ -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';