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

@nx/js/typescript Can't resolve modules in "extends" of tsconfig #28618

Closed
1 of 4 tasks
jonasschultheiss opened this issue Oct 24, 2024 · 4 comments
Closed
1 of 4 tasks

Comments

@jonasschultheiss
Copy link

Current Behavior

I have setup a poc @ my company using nx. I created an internal package, which contains all configuration files for eslint, prettier and typescript. The setup works verifiable with vscode and tsc in the terminal. The problem is, that I can't build the project using nx, as the typescript plugin won't resolve either one of the used extends statements with modules.
The first instance is in the root and the /apps/* tsconfigs, where I extend the internal pnpm workspace package.
The second instance is in the base config in the package (packages/style-guide/typescript/tsconfig.base.json) where I want to use vercels base config as my base.

As it is now, i cannot build my ts apps while this plugin is in the nx.json file.

Expected Behavior

I expect @nx/js/typescript to be able to resolve...

  1. npm packages ("extends": "@vercel/style-guide/typescript/node20")
  2. pnpm workspace packages ("extends": "@pax/style-guide/typescript/next")

... in the "extends" field of tsconfig files

GitHub Repo

https://github.com/jonasschultheiss/poc_branching-versioning-strategy/tree/repro/nx-ts

Steps to Reproduce

  1. Clone project, notice nx.json and nx copy.json. First doesn't have plugin config, later one does.
  2. Run nx reset && pnpm build -> build succeeds
  3. Run mv nx.json nx-no-plugin.json && mv nx\ copy.json nx.json or do it by hand.
  4. Run nx reset && pnpm build --verbose -> build fails

Nx Report

nx (global) : 20.0.5
nx : 20.0.5
@nx/js : 20.0.5
@nx/eslint : 20.0.5
@nx/eslint-plugin : 20.0.5
@nx/next : 20.0.5
typescript : 5.6.3

Registered Plugins:
@nx/next/plugin
@nx/eslint/plugin

Failure Logs

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
An error occurred while processing files for the @nx/js/typescript plugin.
- apps/docs/tsconfig.json: ENOENT: no such file or directory, stat '/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/apps/docs/@pax/style-guide/typescript/next'
Error: ENOENT: no such file or directory, stat '/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/apps/docs/@pax/style-guide/typescript/next'
at statSync (node:fs:1665:25)
at getTsConfigCacheKey (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5_@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:387:46)
at readCachedTsConfig (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:378:22)
at getExtendedConfigFiles (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:292:32)
at createNodesInternal (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:84:33)
at /Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:41:95
at /Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/nx@20.0.5
@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@0.5.13__@swc+types@0.1.13_t_ybqmveuqbang66zbpqsm6724rq/node_modules/nx/src/project-graph/plugins/utils.js:10:33
at Array.map ()
at createNodesFromFiles (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/nx@20.0.5_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@0.5.13__@swc+types@0.1.13_t_ybqmveuqbang66zbpqsm6724rq/node_modules/nx/src/project-graph/plugins/utils.js:8:35)
at exports.createNodesV2 (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5_@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:41:60)
- apps/web/tsconfig.json: ENOENT: no such file or directory, stat '/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/apps/web/@pax/style-guide/typescript/next'
Error: ENOENT: no such file or directory, stat '/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/apps/web/@pax/style-guide/typescript/next'
at statSync (node:fs:1665:25)
at getTsConfigCacheKey (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:387:46)
at readCachedTsConfig (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:378:22)
at getExtendedConfigFiles (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:292:32)
at createNodesInternal (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:84:33)
at /Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5
@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:41:95
at /Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/nx@20.0.5
@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@0.5.13__@swc+types@0.1.13_t_ybqmveuqbang66zbpqsm6724rq/node_modules/nx/src/project-graph/plugins/utils.js:10:33
at Array.map ()
at createNodesFromFiles (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/nx@20.0.5_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@0.5.13__@swc+types@0.1.13_t_ybqmveuqbang66zbpqsm6724rq/node_modules/nx/src/project-graph/plugins/utils.js:8:35)
at exports.createNodesV2 (/Users/jonasschultheiss/coding/poc_branching-versioning-strategy-turbo/node_modules/.pnpm/@nx+js@20.0.5_@babel+traverse@7.25.9_@swc-node+register@1.10.9_@swc+core@1.7.39_@swc+helpers@_bxugnulodkjozofnolsq7zoyuy/node_modules/@nx/js/src/plugins/typescript/plugin.js:41:60)

Package Manager Version

pnpm@9.12.2

Operating System

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

Additional Information

No response

@rads92stx
Copy link

Not sure if it's the same case but I have similar error, while deploying:

Starting Nextjs

 NX   Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it. See errors below.

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
      An error occurred while processing files for the @nx/eslint/plugin plugin.
    - apps/ucts/.eslintrc.json: Failed to load config "../../.eslintrc.json" to extend from.
  Referenced from: /app/apps/ucts/.eslintrc.json
      Error: Failed to load config "../../.eslintrc.json" to extend from.
      Referenced from: /app/apps/ucts/.eslintrc.json
          at configInvalidError (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2648:9)
          at ConfigArrayFactory._loadExtendedShareableConfig (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3279:23)
          at ConfigArrayFactory._loadExtends (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3156:25)
          at ConfigArrayFactory._normalizeObjectConfigDataBody (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3095:25)
          at _normalizeObjectConfigDataBody.next (<anonymous>)
          at ConfigArrayFactory._normalizeObjectConfigData (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
          at _normalizeObjectConfigData.next (<anonymous>)
          at ConfigArrayFactory.loadInDirectory (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
          at CascadingConfigArrayFactory._loadConfigInAncestors (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)
          at CascadingConfigArrayFactory.getConfigArrayForFile (/app/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3792:18)

Locally build is working.

@leosvelperez
Copy link
Member

This was solved by #28535, and the fix was released in Nx v20.0.6.

@rads92stx, that's a different issue. Please create a new issue (if you haven't yet or there isn't one already) with a reproduction or clear steps on how to reproduce it.

@jonasschultheiss
Copy link
Author

thank you 🙌

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 Nov 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants