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

React native application generator uses wrong key name for resolver "blockList" #10328

Closed
ajwootto opened this issue May 16, 2022 · 8 comments · Fixed by #10607
Closed

React native application generator uses wrong key name for resolver "blockList" #10328

ajwootto opened this issue May 16, 2022 · 8 comments · Fixed by #10607
Assignees
Labels
outdated scope: react-native Issues relating to React Native type: bug

Comments

@ajwootto
Copy link
Contributor

Current Behavior

When generating a new react native application, the app will not work if there is anything in the repo's dist/ directory due to a "Duplicate package name" error, as mentioned here:
#8669

The metro.config.js includes a setting called resolver.blacklistRE which is supposed to fix this problem. That setting was renamed in some version of metro to now be blockList

Expected Behavior

A newly generated react native app should start up correctly if there are built packages in the dist/ directory

Steps to Reproduce

  1. have a repo with buildable packages
  2. build a package so it exists in dist/
  3. generate a new react native application
  4. run the application with nx serve

There will be an error about "duplicate packages" because the metro config does not properly ignore the dist/ directory

Failure Logs

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : darwin x64
   yarn : 3.2.0

   nx : 14.0.5
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.0.5
   @nrwl/detox : 14.0.5
   @nrwl/devkit : 14.0.5
   @nrwl/eslint-plugin-nx : 14.0.5
   @nrwl/express : Not Found
   @nrwl/jest : 14.0.5
   @nrwl/js : 14.0.5
   @nrwl/linter : 14.0.5
   @nrwl/nest : Not Found
   @nrwl/next : 14.0.5
   @nrwl/node : 14.0.5
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.0.5
   @nrwl/react-native : 14.0.5
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.0.5
   @nrwl/web : 14.0.5
   @nrwl/workspace : 14.0.5
   typescript : 4.6.3
   rxjs : 6.6.7
@AgentEnder AgentEnder added the scope: react-native Issues relating to React Native label May 16, 2022
@ajwootto
Copy link
Contributor Author

As a followup to this, I've also found that the ignore pattern being used for dist/ doesn't correctly ignore the directory if the react native application is inside of a subdirectory. eg. my app is in apps/some-directory/my-app and because the dist/ directory is up a few folders it seemingly isn't being ignored. I fixed it by changing the pattern to the following:

 resolver: {
               ...,
                blockList: exclusionList([/\/dist\/.*/]),
            },

Basically removing the leading \. character from the pattern. However, I'm not sure if that will have unintended side effects (like is it now ignoring all dist/ directories and not just the root one?)

@xiongemi
Copy link
Collaborator

xiongemi commented Jun 6, 2022

submit a pr #10607 to fix this

@ajwootto
Copy link
Contributor Author

ajwootto commented Jun 7, 2022

@xiongemi thanks for the fix. Did you see my followup note above about the pattern not correctly ignoring the dist/ folder for nested application folders?

@ajwootto
Copy link
Contributor Author

ajwootto commented Jun 7, 2022

@jaysoo since this is now closed should I open a new issue for the second problem I mentioned above?

@xiongemi
Copy link
Collaborator

xiongemi commented Jun 7, 2022

@jaysoo since this is now closed should I open a new issue for the second problem I mentioned above?

what if there is a library in node_modules with the dist folder that we could not block?

@ajwootto
Copy link
Contributor Author

ajwootto commented Jun 7, 2022

yeah that was part of my concern with the pattern I used above, I don't think it's the "correct" fix. But I couldn't come up with a working pattern to specifically exclude just the root-level dist directory but not the dist/ folders in node_modules

@ajwootto
Copy link
Contributor Author

ajwootto commented Jun 8, 2022

opened a new issue here:
#10644

@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 22, 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

Successfully merging a pull request may close this issue.

3 participants