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

Broken typecheck target in packages scaffolded with nx g @nx/js:lib #29145

Open
1 of 4 tasks
ic4l4s9c opened this issue Dec 2, 2024 · 2 comments
Open
1 of 4 tasks

Broken typecheck target in packages scaffolded with nx g @nx/js:lib #29145

ic4l4s9c opened this issue Dec 2, 2024 · 2 comments

Comments

@ic4l4s9c
Copy link

ic4l4s9c commented Dec 2, 2024

Current Behavior

Creating typescript package with nx g @nx/js:lib produces package with broken typecheck target.

Expected Behavior

All automatically created targets should succeed.

GitHub Repo

https://github.com/ic4l4s9c/nx-ts-broken-typecheck-demo

Steps to Reproduce

pnpx create-nx-workspace nx-ts-broken-typecheck-demo --nxCloud=skip --packageManager=pnpm --preset=ts
cd nx-ts-broken-typecheck-demo
pnpx nx g @nx/js:lib packages/ts-lib-vitest --bundler=tsc --linter=eslint --unitTestRunner=vitest
pnpx nx g @nx/js:lib packages/ts-lib-jest --bundler=tsc --linter=eslint --unitTestRunner=jest
pnpm nx run-many --target lint,typecheck,test,build

Nx Report

NX   Report complete - copy this into the issue template

Node           : 22.11.0
OS             : linux-x64
Native Target  : x86_64-linux
pnpm           : 9.14.4

nx                 : 20.1.4
@nx/js             : 20.1.4
@nx/jest           : 20.1.4
@nx/eslint         : 20.1.4
@nx/workspace      : 20.1.4
@nx/devkit         : 20.1.4
@nx/eslint-plugin  : 20.1.4
@nx/vite           : 20.1.4
@nx/web            : 20.1.4
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

% pnpm nx run-many --target lint,typecheck,test,build

   ✔  nx run ts-lib-vitest:build (1s)
   ✔  nx run ts-lib-jest:build (1s)

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
   ✖  nx run ts-lib-jest:typecheck
      > tsc --build --emitDeclarationOnly --pretty --verbose
      
      [2:20:10 PM] Projects in this build: 
          * tsconfig.lib.json
          * tsconfig.spec.json
          * tsconfig.json
      
      [2:20:10 PM] Project 'tsconfig.lib.json' is out of date because output file 'dist/tsconfig.lib.tsbuildinfo' does not exist
      
      [2:20:10 PM] Building project 'nx-ts-broken-typecheck-demo/packages/ts-lib-jest/tsconfig.lib.json'...
      
      [2:20:11 PM] Project 'tsconfig.spec.json' is out of date because output file '../../dist/out-tsc/packages/ts-lib-jest/tsconfig.spec.tsbuildinfo' does not exist
      
      [2:20:11 PM] Building project 'nx-ts-broken-typecheck-demo/packages/ts-lib-jest/tsconfig.spec.json'...
      
      tsconfig.spec.json:5:15 - error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'.
      
      5     "module": "commonjs",
                      ~~~~~~~~~~
      
      
      Found 1 error.
      
      

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
   ✖  nx run ts-lib-vitest:typecheck
      > tsc --build --emitDeclarationOnly --pretty --verbose
      
      [2:20:12 PM] Projects in this build: 
          * tsconfig.lib.json
          * tsconfig.spec.json
          * tsconfig.json
      
      [2:20:12 PM] Project 'tsconfig.lib.json' is up to date because newest input 'src/index.ts' is older than output 'dist/tsconfig.lib.tsbuildinfo'
      
      [2:20:12 PM] Project 'tsconfig.spec.json' is out of date because output file '../../dist/out-tsc/packages/ts-lib-vitest/tsconfig.spec.tsbuildinfo' does not exist
      
      [2:20:12 PM] Building project 'nx-ts-broken-typecheck-demo/packages/ts-lib-vitest/tsconfig.spec.json'...
      
      vite.config.ts:1:10 - error TS2305: Module '"vite"' has no exported member 'defineConfig'.
      
      1 import { defineConfig } from 'vite';
                 ~~~~~~~~~~~~
      
      
      Found 1 error.
      
      
   ✔  nx run ts-lib-vitest:test (2s)
   ✔  nx run ts-lib-vitest:lint (2s)
   ✔  nx run ts-lib-jest:lint (2s)
   ✔  nx run ts-lib-jest:test (3s)

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran targets lint, typecheck, test, build for 2 projects (6s)

   ✔  6/8 succeeded [0 read from cache]

   ✖  2/8 targets failed, including the following:

      - nx run ts-lib-jest:typecheck
      - nx run ts-lib-vitest:typecheck

 Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.

Package Manager Version

9.14.4

Operating System

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

Additional Information

Looking for preferable/recommended workaround.

@zmzlois
Copy link

zmzlois commented Dec 3, 2024

if you pass in the environment variable: export NX_IGNORE_UNSUPPORTED_TS_SETUP=true in terminal does it work?

@ic4l4s9c
Copy link
Author

ic4l4s9c commented Dec 3, 2024

No, the results are identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants