-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Current Behavior
In our monorepo we use local plugins for our custom executors and generators. In NX 18.2.4 these generators are working as expected, but after upgrading to NX 18.3.x the Typescript is not transpiled which results in a Cannot find module
error

This error is caused by PR #22527. This PR adds running plugins in isolation behind a flag, but unfortunately, not all the functionally is behind the flag and it impacts also projects that don't have set the flag at the moment.
The error only occurs for generators that have an implementation pointing to a directory with an index.ts file. When you point the implemenation in the generators.json points to a ts file directly it works as expected.
Expected Behavior
The expected behavior is that generators are working in both NX 18.2.4 as in 18.3.x. Generators written in Typescript need to be transpiled before executed like it does in 18.2.4
GitHub Repo
Steps to Reproduce
- checkout the example repo
- yarn install
- run generator
yarn nx g @nx-example/my-plugin:my-generator --dry-run
Nx Report
Node : 20.12.0
OS : darwin-arm64
yarn : 1.22.19
nx : 18.3.0
@nx/js : 18.3.0
@nx/jest : 18.3.0
@nx/linter : 18.3.0
@nx/eslint : 18.3.0
@nx/workspace : 18.3.0
@nx/angular : 18.3.0
@nx/cypress : 18.3.0
@nx/devkit : 18.3.0
@nx/eslint-plugin : 18.3.0
@nx/plugin : 18.3.0
@nx/react : 18.3.0
@nrwl/tao : 18.3.0
@nx/web : 18.3.0
@nx/webpack : 18.3.0
typescript : 5.4.5
---------------------------------------
Community plugins:
@ngrx/component-store : 17.0.1
@ngrx/effects : 17.0.1
@ngrx/entity : 17.0.1
@ngrx/router-store : 17.0.1
@ngrx/store : 17.0.1
@ngrx/store-devtools : 17.0.1
---------------------------------------
Local workspace plugins:
@nx-example/my-plugin
Failure Logs
NX Cannot find module '/Users/roozenboom/Work/npm/nx-examples/tools/my-plugin/src/generators/my-generator'
Require stack:
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/src/config/schema-utils.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/src/command-line/generate/generator-utils.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/src/command-line/generate/generate.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/src/command-line/generate/command-object.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/src/command-line/nx-commands.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/bin/init-local.js
- /Users/roozenboom/Work/npm/nx-examples/node_modules/nx/bin/nx.js
Pass --verbose to see the stacktrace.
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response