Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest-haste-map: Haste module naming collision due to nx build artefacts #7245

Closed
farcaller opened this issue Oct 5, 2021 · 5 comments
Closed
Assignees
Labels
outdated scope: react-native Issues relating to React Native type: bug

Comments

@farcaller
Copy link

farcaller commented Oct 5, 2021

Current Behavior

react-native's nx run-android fails with:

> Evaluating settings
jest-haste-map: Haste module naming collision: @myapp/myplugin
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/libs/myplugin/package.json
    * <rootDir>/dist/libs/myplugin/package.json

Failed to construct transformer:  DuplicateError: Duplicated files or mocks. Please check the console for more info

Expected Behavior

nx run-android works

Steps to Reproduce

  1. Generate a react-native app: npx nx g @nrwl/react-native:app awesome-app
  2. Generate a nx plugin: nx g @nrwl/nx-plugin:plugin myplugin
  3. Build the plugin: nx build myplugin
  4. Try to run the react-native app: nx run-android

Environment

  Node : 16.2.0
  OS   : linux x64
  yarn : 1.22.10

  nx : 12.9.0
  @nrwl/angular : Not Found
  @nrwl/cli : 12.9.0
  @nrwl/cypress : 12.9.0
  @nrwl/devkit : 12.9.0
  @nrwl/eslint-plugin-nx : 12.9.0
  @nrwl/express : Not Found
  @nrwl/jest : 12.9.0
  @nrwl/linter : 12.9.0
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 12.9.0
  @nrwl/nx-cloud : Not Found
  @nrwl/react : 12.9.0
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.9.0
  @nrwl/web : 12.9.0
  @nrwl/workspace : 12.9.0
  @nrwl/storybook : 12.9.0
  @nrwl/gatsby : Not Found
  typescript : 4.3.5

@nrwl/react-native is at 12.9.0 too

@FrozenPandaz FrozenPandaz added the scope: react-native Issues relating to React Native label Oct 8, 2021
@xiongemi
Copy link
Collaborator

xiongemi commented Oct 18, 2021

i think it might be related to this react-native issue: react-native-async-storage/async-storage#169.
maybe try to add: blacklistRE: /libs\/myplugin/ to resolver in metro.config.js.

resolver: {
        ...
        blacklistRE: /libs\/myplugin/
      },
``

@xorob0
Copy link

xorob0 commented Oct 21, 2021

Getting the same error on nx 13.
blacklistRE did not solve it, even after cleaning.

@xiongemi
Copy link
Collaborator

xiongemi commented Oct 21, 2021

i setup the example app: https://github.com/xiongemi/nx-react-native-example/tree/jest-haste-map

it works for me when i add:
blacklistRE: /libs\/myplugin\/package.json/

as shown: https://github.com/xiongemi/nx-react-native-example/pull/1/files

i could run nx run-android and nx run-ios.

@xorob0
Copy link

xorob0 commented Oct 22, 2021

Thanks that worked for me

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

No branches or pull requests

4 participants