metro-bundler: ModuleGraph: fix in-memory node-haste impl error

Reviewed By: cpojer

Differential Revision: D6323532

fbshipit-source-id: 067be85171d8d8839c977bd2aa7fdc7efc178f0a
This commit is contained in:
Jean Lauliac 2017-11-14 06:07:24 -08:00 committed by Facebook Github Bot
parent b75f385524
commit 56e790f958
1 changed files with 4 additions and 3 deletions

View File

@ -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.',
);