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

Local nx plugin generator TypeScript transpiler not loaded in NX 18.3.x #22958

Closed
1 of 4 tasks
Roozenboom opened this issue Apr 23, 2024 · 1 comment · Fixed by #22964
Closed
1 of 4 tasks

Local nx plugin generator TypeScript transpiler not loaded in NX 18.3.x #22958

Roozenboom opened this issue Apr 23, 2024 · 1 comment · Fixed by #22964

Comments

@Roozenboom
Copy link
Contributor

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

Screenshot 2024-04-23 at 16 37 06

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

nrwl/nx-examples#327

Steps to Reproduce

  1. checkout the example repo
  2. yarn install
  3. 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

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 May 24, 2024
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.

1 participant