question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build fails with a failed to resolve "extends":"../../tsconfig.json"

See original GitHub issue

Describe the bug

I am trying to build a new React (Typescript) app but I get this error:

[vite:esbuild] failed to resolve "extends":"../../tsconfig.json" in /Users/me/my-app/node_modules/@my-library/my-package/tsconfig.json

This comes from my organization’s monorepo. Is there any way to solve this? I can see from the documentation that using extends can affect the build.

Reproduction

Unfortunately I cannot post any code since this is a private repo but the build fails on my package that get’s imported from my organisation’s monorepo (lerna, workspaces).

System Info

System:
    OS: macOS 11.5.2
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 318.47 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.7 - ~/.nvm/versions/node/v12.22.7/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v12.22.7/bin/npm
  Browsers:
    Brave Browser: 97.1.34.81
    Chrome: 97.0.4692.99
    Chrome Canary: 100.0.4862.3
    Edge: 97.0.1072.76
    Firefox: 91.0.2
    Firefox Developer Edition: 97.0
    Safari: 14.1.2
  npmPackages:
    @vitejs/plugin-react: ^1.0.7 => 1.1.4 
    vite: ^2.7.2 => 2.7.13

Used Package Manager

yarn

Logs

[vite:esbuild] failed to resolve "extends":"../../tsconfig.json" in /Users/me/my-app/node_modules/@my-library/my-package/tsconfig.json
file: /Users/me/my-app/node_modules/@my-library/my-package/index.ts
error during build:
TSConfckParseError: failed to resolve "extends":"../../tsconfig.json" in /Users/me/my-app/node_modules/@my-library/my-package/tsconfig.json
    at resolveExtends (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22291:11)
    at parseExtends (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22275:34)
    at parse$e (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22226:24)
    at async loadTsconfigJsonForFile (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22567:24)
    at async transformWithEsbuild (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22404:36)
    at async Object.transform (/Users/me/my-app/node_modules/vite/dist/node/chunks/dep-f5552faa.js:22488:32)
    at async transform (/Users/me/my-app/node_modules/rollup/dist/shared/rollup.js:21959:16)
    at async ModuleLoader.addModuleSource (/Users/me/my-app/node_modules/rollup/dist/shared/rollup.js:22192:30)
[!] Error: unfinished hook action(s) on exit:

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TeckTncommented, Feb 3, 2022

Thank’s for your answer. Yarn dev works perfectly. I have only this issue with yarn build.

0reactions
dominikgcommented, Feb 3, 2022

I have exactly the same issue with this package : @axa-fr/react-oidc-redux You could add it and you will see that yarn build faild with the same error message.

see https://github.com/AxaGuilDEv/react-oidc/issues/671

it seems in that case the issue is that their package.json contains a legacy “jsnext:main” entry that takes precedence in vite. @iakovosvo you may want to check your project for a similar field

I use react-ts template with yarn 3 with pnp mode.

esm support with yarn pnp has been less than pleasant (read: not working) in the past. does it work now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Astro Build Error, Markdown with Typescript - Stack Overflow
Just as the compiler said, there was a problem with "extends": "astro/tsconfigs/strict" . It could not locate the resource.
Read more >
Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >
ts-node - npm
{ "extends": "ts-node/node16/tsconfig.json", // Or install directly with ... node may either fail to resolve it or attempt to execute it as ...
Read more >
Typescript does not resolve modules through tsconfig.json's ...
The problem is that you have "files":[] section that only includes a file from typings. If there is a 'files' section in tsconfig.json,...
Read more >
TypeScript - Astro Documentation
In your .tsconfig file, you can instruct TypeScript to help with this. The importsNotUsedAsValues setting can be set to error . Then, TypeScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found