nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

Local project graph plugins fail to load preventing any tasks being run #12340

Closed ashley-hunter closed 2 years ago

ashley-hunter commented 2 years ago

Current Behavior

When registering a local project graph plugin in nx.json we now get an error in 14.8.2 when we try to run any tasks:

"plugins": [
    "./tools/project-graph-plugins/plugin.js"
  ],

We now get a module not found error when trying to run any tasks. I believe this is because it is trying to resolve it from a project root, whereas before this was resolved based on the workspace root.

I believe this issue was introduced by the following commit:

https://github.com/nrwl/nx/commit/9b63ce167acb08faaf55bdf899055ae04a87036f#diff-c13565e7b12b241ee14541d4a40870cdc0484ae1bfdb5488be0767d3c0b8455fR53

Expected Behavior

This should continue to work as it previously did, allowing relative paths to project graph plugins.

Steps to Reproduce

See reproduction environment here: https://github.com/nrwl/nx-examples/pull/233

Failure Logs

Error: Cannot find module './tools/project-graph-plugins/plugin.js'
Require stack:
- /Users/ashley/Documents/GitHub/ux-aspects-reuse-poc/node_modules/nx/src/utils/nx-plugin.js
- /Users/ashley/Documents/GitHub/ux-aspects-reuse-poc/node_modules/nx/src/config/workspaces.js

Environment

   Node : 16.13.0
   OS   : darwin x64
   yarn : 1.22.19

   nx : 14.8.2
   @nrwl/angular : 14.8.2
   @nrwl/cypress : 14.8.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.8.2
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 14.8.2
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.8.2
   @nrwl/js : 14.8.2
   @nrwl/linter : 14.8.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.7.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.8.2
   @nrwl/react-native : Not Found
   @nrwl/rollup : 14.8.2
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.8.2
   @nrwl/web : 14.8.2
   @nrwl/webpack : 14.8.2
   @nrwl/workspace : 14.8.2
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @ngrx/component-store: 14.0.2
         @ngrx/effects: 14.0.2
         @ngrx/entity: 14.0.2
         @ngrx/router-store: 14.0.2
         @ngrx/store: 14.0.2
         @ngrx/store-devtools: 14.0.2
ashley-hunter commented 2 years ago

Great! Thank you very much!

AgentEnder commented 2 years ago

Thanks for the good issue report!

github-actions[bot] commented 1 year ago

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.