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

@nrwl/node:node calculateResolveMappings doesn't think about version of library #11221

Closed
zyf0330 opened this issue Jul 20, 2022 · 7 comments
Closed
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx stale type: bug

Comments

@zyf0330
Copy link
Contributor

zyf0330 commented Jul 20, 2022

Current Behavior

My workspace includes a buildable library A as npm package, and includes an application B which depends on the previous package A, but older version.
Now @nrwl/node executor calculateResolveMappings doesn't think about version of the depended package A in the application B and always set built package for application B requiring maping.
And this application B depends on another package C which depends on different version package A. So this calculateResolveMappings breaks C too.

I set enableTransparentWorkspaces: false for yarn, let it install package A into node_modules, not link it to local workspace package.

Expected Behavior

@nrwl/node:node should think about version of library package A, or provide an option to bypass link.

Steps to Reproduce

If there is any misunderstooding, I will provide demo.

Failure Logs

Environment

related to #9346


 >  NX   Report complete - copy this into the issue template

   Node : 14.18.3
   OS   : linux x64
   yarn : 3.2.0
   
   nx : 14.2.4
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.4
   @nrwl/eslint-plugin-nx : 14.2.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.2.4
   @nrwl/js : 14.2.4
   @nrwl/linter : 14.2.4
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.2.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.2.4
   typescript : 4.6.4
   ---------------------------------------
   Community plugins:
@zyf0330
Copy link
Contributor Author

zyf0330 commented Jul 20, 2022

And another thing, since nx project dependency graph shows application B depends on package A, why doesn't build it automaticlly?
I don't declare explicit dependsOn relationship in the project.json for them.

@AgentEnder
Copy link
Member

And another thing, since nx project dependency graph shows application B depends on package A, why doesn't build it automaticlly?
I don't declare explicit dependsOn relationship in the project.json for them.

Can you check targetDefaults or targetDependencies in nx.json and paste that here?

provide an option to bypass link.

I think this would be the best path forward for this issue.

@AgentEnder AgentEnder added the scope: node Issues related to Node, Express, NestJS support for Nx label Jul 20, 2022
@zyf0330
Copy link
Contributor Author

zyf0330 commented Jul 21, 2022

Thanks for your reply!

Can you check targetDefaults or targetDependencies in nx.json and paste that here?

This is my targetDependencies

  "targetDependencies": {
    "build": [
      {
        "target": "build",
        "projects": "dependencies"
      }
    ]
  },

I remember that serve task with @nrwl/node:node executor doesn't respect dependsOn of its buildTarget, so maybe this is the reason why package A doesn't be built automaticlly.

nartc added a commit to nartc/nx that referenced this issue Jul 21, 2022
nartc added a commit to nartc/nx that referenced this issue Jul 21, 2022
@nartc
Copy link
Contributor

nartc commented Jul 28, 2022

hi @zyf0330, a flag might not be the best path moving forward. Can you provide a sample reproduce so I can understand the issue better?

@zyf0330
Copy link
Contributor Author

zyf0330 commented Aug 2, 2022

hi @zyf0330, a flag might not be the best path moving forward. Can you provide a sample reproduce so I can understand the issue better?

Ok, please waiting for my demo project.

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@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 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx stale type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants