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

Can't call a library in a plugin from the same workspace #6712

Closed
Arcahub opened this issue Aug 13, 2021 · 28 comments · Fixed by #9116
Closed

Can't call a library in a plugin from the same workspace #6712

Arcahub opened this issue Aug 13, 2021 · 28 comments · Fixed by #9116

Comments

@Arcahub
Copy link

Arcahub commented Aug 13, 2021

Current Behavior

I can't use a library in a plugin of the same workspace

Expected Behavior

I should be able to use a library in a plugin of the same workspace

Example:
I create a @nrwl/nx-plugin and i want to use its generator in another @nrwl/nx-plugin
I create a @nrwl/node library and i want to use its function in a @nrwl/nx-plugin

Steps to Reproduce

Clone this repo
Run the following commands:

  • yarn
  • yarn run nx build plugin-app
  • yarn run nx generate ./dist/libs/plugin-app:plugin-app

Failure Logs

@> yarn run nx generate ./dist/libs/plugin-app:plugin-app
yarn run v1.22.5
$ nx generate ./dist/libs/plugin-app:plugin-app
✔ What name would you like to use? · my-app
Cannot find module '@share-generators-over-plugins/plugin-lib'
Require stack:
- /home/arcarox/Documents/test/share-generators-over-plugins/dist/libs/plugin-app/src/generators/plugin-app/generator.js
- /home/arcarox/Documents/test/share-generators-over-plugins/node_modules/@nrwl/tao/src/shared/workspace.js
- /home/arcarox/Documents/test/share-generators-over-plugins/node_modules/@nrwl/tao/src/commands/generate.js
- /home/arcarox/Documents/test/share-generators-over-plugins/node_modules/@nrwl/tao/index.js
- /home/arcarox/Documents/test/share-generators-over-plugins/node_modules/@nrwl/cli/lib/init-local.js
- /home/arcarox/Documents/test/share-generators-over-plugins/node_modules/@nrwl/cli/bin/nx.js
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

@> yarn run nx report
yarn run v1.22.5
$ nx report

>  NX  Report complete - copy this into the issue template

  Node : 12.19.0
  OS   : linux x64
  yarn : 1.22.5
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.7.0
  @nrwl/cypress : Not Found
  @nrwl/devkit : 12.7.0
  @nrwl/eslint-plugin-nx : 12.7.0
  @nrwl/express : Not Found
  @nrwl/jest : 12.7.0
  @nrwl/linter : 12.7.0
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 12.7.0
  @nrwl/nx-cloud : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.7.0
  @nrwl/web : Not Found
  @nrwl/workspace : 12.7.0
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.3.5

Done in 0.32s.
@FrozenPandaz
Copy link
Collaborator

Hi, it seems like your repo only has the initial commit with no apps or libs added.

Can you update it please? 🙏

https://github.com/Arcahub/nx-plugin-in-other-plugin

@Arcahub
Copy link
Author

Arcahub commented Aug 13, 2021

Yeah sorry about that 😅. It should be all good now.

@Arcahub Arcahub changed the title Can't call a library in an other library from the same workspace Can't call a library in a plugin from the same workspace Aug 13, 2021
@Arcahub
Copy link
Author

Arcahub commented Aug 18, 2021

Hey, I've been searching for a solution for my issue and i've found that the problem don't seems to be directly link to nx. The error occurs when node try to require the lib using @share-generators-over-plugins/plugin-lib using this logic to find the module (https://nodejs.org/docs/v0.4.2/api/modules.html#all_Together...) .
A fix might to update the build executor of plugins to copy the outdir to node_module/${importPath}

@hadrien-toma
Copy link

I am also able to reproduce this issue... So it seems we are not able to get all the benefits of a monorepo for plugins which is really a shame 😭

@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 github-actions bot added the stale label Sep 16, 2021
@hadrien-toma
Copy link

It is a crucial feature for my use of Nx...

@hadrien-toma
Copy link

@FrozenPandaz can you now remove the blocked label? The author provided a way to test since quite a long time

@github-actions github-actions bot removed the stale label Sep 17, 2021
@github-actions
Copy link

github-actions bot commented Oct 1, 2021

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 github-actions bot added the stale label Oct 1, 2021
@hadrien-toma
Copy link

@FrozenPandaz ? 😣

@github-actions github-actions bot removed the stale label Oct 2, 2021
@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 github-actions bot added the stale label Oct 16, 2021
@hadrien-toma
Copy link

😕

@github-actions github-actions bot removed the stale label Oct 17, 2021
@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 github-actions bot added the stale label Oct 31, 2021
@hadrien-toma
Copy link

🍀

@github-actions github-actions bot removed the stale label Nov 1, 2021
@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 github-actions bot added the stale label Nov 15, 2021
@hadrien-toma
Copy link

🍀🤞

@sybernatus
Copy link

Hello, same issue here ! 🙏

@github-actions github-actions bot removed the stale label Nov 16, 2021
@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 github-actions bot added the stale label Nov 30, 2021
@hadrien-toma
Copy link

🥺

@github-actions github-actions bot removed the stale label Dec 1, 2021
@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 github-actions bot added the stale label Dec 15, 2021
@hadrien-toma
Copy link

😣

@github-actions github-actions bot removed the stale label Dec 17, 2021
@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 github-actions bot added the stale label Dec 31, 2021
@hadrien-toma
Copy link

😶‍🌫️

@github-actions github-actions bot removed the stale label Jan 1, 2022
@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 github-actions bot added the stale label Jan 16, 2022
@hadrien-toma
Copy link

🥴

@github-actions github-actions bot removed the stale label Jan 17, 2022
@github-actions
Copy link

github-actions bot commented Feb 1, 2022

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 github-actions bot added the stale label Feb 1, 2022
@hadrien-toma
Copy link

@Arcahub may you create a new issue to track this? I think the very old wrong label regarding the reproduction is likely to make this issue not important whereas in my point view, it is critical...

@AgentEnder
Copy link
Member

This should be fixed as part of #9116

@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants