1

Let's see the error first:

jest-haste-map: Haste module naming collision: @stevemoretz/yoohoo
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/.yalc/@stevemoretz/yoohoo-ratchet-expo/.yalc/package-name2/package.json
    * <rootDir>/.yalc/package-name1/package.json

Failed to construct transformer:  DuplicateError: Duplicated files or mocks. Please check the console for more info
    at setModule (/Volumes/HDD/ReactNative/upgrade/store/node_modules/jest-haste-map/build/index.js:543:17)
    at workerReply (/Volumes/HDD/ReactNative/upgrade/store/node_modules/jest-haste-map/build/index.js:614:9)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Promise.all (index 27)
    at /Volumes/HDD/ReactNative/upgrade/store/node_modules/jest-haste-map/build/index.js:426:22 {
  mockPath1: '.yalc/package-name1/.yalc/@stevemoretz/yoohoo/package.json',
  mockPath2: '.yalc/package-name2/package.json'
}

What's happening? I'm using a nested yalc package in another yalc package, so I get this error, how do I solve that?

Steve Moretz
  • 2,758
  • 1
  • 17
  • 31

1 Answers1

0

Getting rid of .yalc folder, fixes this but we can't do that because yalc won't work well .

But we can exclude it from the metro bundler that fixes it, how? https://stackoverflow.com/a/41963217/10268067

so in our case it becomes:

const exclusionList = require("metro-config/src/defaults/exclusionList");

// exclusionList is a function that takes an array of regexes and combines
// them with the default exclusions to return a single regex.

module.exports = {
    resolver: {
        blacklistRE: exclusionList([/.yalc\/.*/]),
    },
};
Steve Moretz
  • 2,758
  • 1
  • 17
  • 31