bun icon indicating copy to clipboard operation
bun copied to clipboard

Bun doesn't support tsconfig.json which consist of references to other tsconfigs

Open danulqua opened this issue 2 years ago • 11 comments

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

  1. Create main tsconfig.json and another tsconfig.app.json
  2. In the tsconfig.app.json add
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
  1. In the tsconfig.json add
{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    }
  ],
}
  1. In the code, import something using created @ alias

What is the expected behavior?

Imports using alias work as expected.

What do you see instead?

"Cannot find module" error occurs:

image

As soon as you add paths in the main tsconfig.json, it works as expected:

image

(Don't mind other errors, I'm playing around with an existing Vue project and it seems that Bun isn't able to work with it).

Additional information

In conclusion, I guess that Bun doesn't take into account other tsconfigs referenced by the main tsconfig.

danulqua avatar Sep 10 '23 07:09 danulqua

I'm working on monorepo and also have multiple tsconfig with root config and others are referencing to it. Facing same issue that paths aren't considered and ending up with error that Bun can't resolve @someAlias/dir/file

zavodnyuk avatar Dec 03 '23 08:12 zavodnyuk

Same as @zavodnyuk, i have multiples tsconfig references.

is there any workaround ?

Madscientiste avatar Apr 08 '24 13:04 Madscientiste