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

File '@ljharb/tsconfig' not found. #363

Open
2 tasks
zhengxs2018 opened this issue Mar 11, 2024 · 7 comments
Open
2 tasks

File '@ljharb/tsconfig' not found. #363

zhengxs2018 opened this issue Mar 11, 2024 · 7 comments
Labels
bug Something isn't working pr welcome

Comments

@zhengxs2018
Copy link

zhengxs2018 commented Mar 11, 2024

Problem

I was using the 4.0.3 version before but since yesterday it has been reporting an error

The code and module that went wrong have been identified through both projects, but I didn't find out whose dependency this error message is from

qs -> side-channel -> get-intrinsic -> es-errors
image
jsonwebtoken -> jws -> util
image

If you use esbuild-loader with the above 2 modules in your project, you get the error

Error: File '@ljharb/tsconfig' not found.
    at je (/Users/zhengxs/demo/node_modules/get-tsconfig/dist/index.cjs:3:9102)
    at te (/Users/zhengxs/demo/node_modules/get-tsconfig/dist/index.cjs:3:10066)
    at ie (/Users/zhengxs/demo/node_modules/get-tsconfig/dist/index.cjs:3:10781)
    at Object.$e [as getTsconfig] (/Users/zhengxs/demo/node_modules/get-tsconfig/dist/index.cjs:3:10886)
    at Object.ESBuildLoader (/Users/zhengxs/demo/node_modules/esbuild-loader/dist/index.cjs:65:36)
    at LOADER_EXECUTION (/Users/zhengxs/demo/node_modules/loader-runner/lib/LoaderRunner.js:132:14)
    at runSyncOrAsync (/Users/zhengxs/demo/node_modules/loader-runner/lib/LoaderRunner.js:133:4)
    at iterateNormalLoaders (/Users/zhengxs/demo/node_modules/loader-runner/lib/LoaderRunner.js:251:2)
    at /Users/zhengxs/demo/node_modules/loader-runner/lib/LoaderRunner.js:224:4
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Expected behavior

Bundle Success

Minimal reproduction URL

https://stackblitz.com/edit/node-gcfggk?file=package.json

Version

v4.0.3

Node.js version

v16.0.0

Package manager

yarn

Operating system

macOS

Contributions

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@zhengxs2018 zhengxs2018 added bug Something isn't working pending triage labels Mar 11, 2024
@privatenumber

This comment was marked as off-topic.

@zhengxs2018

This comment was marked as off-topic.

@privatenumber

This comment was marked as off-topic.

@privatenumber privatenumber closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@zhengxs2018

This comment was marked as off-topic.

@privatenumber

This comment was marked as off-topic.

@srakesh009

This comment was marked as off-topic.

@privatenumber
Copy link
Owner

Why is this happening?

  • ljharb recently updated packages with a tsconfig.json that extends @ljharb/tsconfig
  • esbuild-loader resolving tsconfig.json on dependency imports (bug)

In the minimal reproduction provided above, it's happening because of set-function-length & hasown. You can grep your node_modules for @ljharb/tsconfig to find which packages are causing this.

While these errors started happening as a result of ljharb publishing these tsconfig.json files (which may be an oversight since it's a dev concern), the bug is in esbuild-loader resolving tsconfig files in dependencies.

Solution

The fix should be simple: resolve tsconfig conditionally if the real path is not in node_modules.

Next steps

I'm happy to accept & review a PR. It should contain a test for this case (fake dependency fixture with tsconfig.json).

Locking thread to direct further conversation to PRs.

Repository owner locked and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants