Build fails with a failed to resolve "extends":"../../tsconfig.json"
See original GitHub issueDescribe 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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank’s for your answer. Yarn dev works perfectly. I have only this issue with yarn build.
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
esm support with yarn pnp has been less than pleasant (read: not working) in the past. does it work now?