bun
bun copied to clipboard
Support `extends` in `tsconfig.json`
When using paths in tsconfig.json
to reference files in outer directories, the compiler fails to resolve:
{
"compilerOptions": {
"paths": {
"lib/ts/*": ["./lib/ts/*"]
}
}
}
error: Could not resolve: "lib/coderapi/legacy". Maybe you need to "npm install" (or yarn/pnpm)?
import { License, updateLicense } from "lib/coderapi/legacy"
Have you tried setting baseUrl
? For example:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"lib/ts/*": ["./lib/ts/*"]
}
}
}
Yup. Our tsconfig.json uses the extends
property to a higher-level directory... maybe that's the problem?
maybe that's the problem?
Most likely. extends
is not implemented yet, and won't be a priority for ~a month probably.
If you try (temporarily) inlining what extends
would do into the tsconfig.json
, does that fix it?
to reference files in outer directories
I was wondering if this was the issue, but it doesn't seem to be.
When above-the-root
references a specific file:
When above-the-root
references a folder:
Ahh I appreciate the investigation. I'll update the title/description, or feel free to close if it's already planned.
There isn't an issue tracking extends
support currently, so this can be that issue
Is this work currently planned? I'd love to integrate this into my repo at work, but we heavily rely on extends
in tsconfig
Jarred,
Thanks for all the hard work on this incredible tool. I was playing around with converting my nx monorepo to bun and ran into this issue. Where I have a base tsconfig.json
in the root of my monorepo and my react apps under an apps
folder that extend from the base. Looking forward to when this issue can be prioritized. Just posting this to help gauge use case and interest. Thanks.
Another vote for this issue - we have a frontend monorepo which makes heavy use of extended tsconfigs. We also use custom module resolution, which ought to work via tsconfig paths
, but the path mapping is defined in some shared/extended config files.
Hi!
Is the difficulty here knowing which values extends
includes, as well as what value to use when expanding relative paths?
Would porting an existing solution to Zig be a solution to this? https://github.com/privatenumber/get-tsconfig
Is this project something somebody new to Zig could take on?
Thanks for creating Bun and any insights that could help with this work!
Excited about Bun, but... also blocked on this!
This was added months ago and I forgot to close the issue