Skip to content

@nx/node:library generator sets "tslib" as dep instead of "@swc/helpers" when compiler is set to "swc" #31202

@ckot

Description

@ckot

Current Behavior

I use the @nx/node:library generator and specify that I want 'swc' as my compiler

eslint @nx/dependency-checker discovers that the dependency "tslib" isn't used by the project and that the project makes use of "@swc/helpers" which isn't in the dependencies

<workspaceRoot>/libs/my-lib/package.json
  35:3  error  The "my-lib" project uses the following packages, but they are missing from "dependencies":
    - @swc/helpers  @nx/dependency-checks
  36:5  error  The "tslib" package is not used by "my-lib" project                                                             @nx/dependency-checks

Expected Behavior

the generator, knowing that the compiler is set to 'swc' would install @swc/helpers rather than tslib as a dependency

GitHub Repo

No response

Steps to Reproduce

  1. npx nx generate @nx/node:library --directory=libs/my-iib --compiler=swc --linter=eslint --name=my-lib --unitTestRunner=jest --importPath=@myorg/my-lib
  2. npx nx run my-lib:lint

Nx Report

nx report

 NX   Report complete - copy this into the issue template

Node           : 22.14.0
OS             : darwin-x64
Native Target  : x86_64-macos
npm            : 10.9.2

nx (global)            : 20.6.2
nx                     : 20.8.0
@nx/js                 : 20.8.0
@nx/jest               : 20.8.0
@nx/eslint             : 20.8.0
@nx/workspace          : 20.8.0
@nx/devkit             : 20.8.0
@nx/esbuild            : 20.8.0
@nx/eslint-plugin      : 20.8.0
@nx/module-federation  : 20.8.0
@nx/node               : 20.8.0
@nx/react              : 20.8.0
@nx/vite               : 20.8.0
@nx/web                : 20.8.0
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/react/router-plugin
@nx/eslint/plugin
@nx/vite/plugin
@nx/jest/plugin
---------------------------------------
Cache Usage: 46.31 KB / 186.27 GB

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Labels

outdatedpriority: mediumMedium Priority (not high, not low priority)scope: linterIssues related to Eslint support in Nxscope: nodeIssues related to Node, Express, NestJS support for Nxtype: bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions