From 56e790f958cb2c19cf32c38653b5a8395b0afe39 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 14 Nov 2017 06:07:24 -0800 Subject: [PATCH] metro-bundler: ModuleGraph: fix in-memory node-haste impl error Reviewed By: cpojer Differential Revision: D6323532 fbshipit-source-id: 067be85171d8d8839c977bd2aa7fdc7efc178f0a --- .../metro-bundler/src/ModuleGraph/node-haste/node-haste.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/metro-bundler/src/ModuleGraph/node-haste/node-haste.js b/packages/metro-bundler/src/ModuleGraph/node-haste/node-haste.js index 8920bd71..761dc4cb 100644 --- a/packages/metro-bundler/src/ModuleGraph/node-haste/node-haste.js +++ b/packages/metro-bundler/src/ModuleGraph/node-haste/node-haste.js @@ -91,11 +91,12 @@ const createModuleMap = ({files, helpers, moduleCache, sourceExts}) => { // 0 = Module, 1 = Package in jest-haste-map map[id][platform] = [filePath, module.type === 'Package' ? 1 : 0]; - if (existingModule && existingModule.path !== filePath) { + if (existingModule && existingModule[0] !== filePath) { throw new Error( `@providesModule naming collision:\n` + - ` Duplicate module name: ${id}\n` + - ` Paths: ${filePath} collides with ${existingModule.path}\n\n` + + ` Duplicate module name: \`${id}\`\n` + + ` Paths: \`${filePath}\` collides with ` + + `\`${existingModule[0]}\`\n\n` + 'This error is caused by a @providesModule declaration ' + 'with the same name across two different files.', );