Open ceopaludetto opened 1 year ago
Having trouble reproducing this. Would you be willing to upload a zip file or link to a git repo to clone that reproduces this issue?
After some investigation I found the problem. When you extend tsconfig
with a custom package, path aliases stop working on bun test(and probably on every bun execution context like bun run).
Minimal reproduction: https://codesandbox.io/p/sandbox/bun-reproduction-v3gw9h
As you can see, in ./packages/example/tsconfig.json
we have:
{
"extends": "@acme/configuration/tsconfig.base.json",
"compilerOptions": { ... }
}
If you comment the extends
line, path aliases will start to work again. Actually there's another strange behavior, if you extends from a local file, something like "extends": "./tsconfig.base.json"
it also work as expected. Only inheritances from other packages causes the bug
@Jarred-Sumner congrats on the release of 1.0
Will the team be able to allocate some time to look into this? @ceopaludetto was able to put a minimal reproduction example.
Can we be of help in any way?
Thanks in advance
Seems to be fixed on Bun 1.0.2
@ceopaludetto feel free to close this if you can confirm it is working as expected now
It is still reproducible, using bun test v1.0.22
It works only without "extends": "./some.config.json"
(extending config from local file)
It's still the case, when I extend the tsconfig in a monorepo.
Version: 1.0.30
Doesn't work with references either:
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}
Some of the vite official templates do that. I can just change to one tsconfig.json but just FYI
Still an issue with v1.1.22
.
It works without "extends": "./some.config.json"
I found this to stil be an issue and this was the cause in mine too; i.e. aliases defined in tsconfig.jsonc
fail when "extends": "./.svelte-kit/tsconfig.json"
exists in my tsconfig.jsonc
, but they work (allowing my bun:test tests to pass) if I remove the extends
property.
Bun 1.1.26
@Electroid this is worth reopening please
What version of Bun is running?
0.6.14
What platform is your computer?
Darwin 22.5.0 arm64 arm
What steps can reproduce the bug?
Configure
tsconfig.json
:Create a test folder in root:
Create a simple test:
What is the expected behavior?
The import of
~/number
should work as expectedWhat do you see instead?
--cwd
option:-> bun --cwd packages/utilities test $ bun test bun test v0.6.14 (\b5665739)
test/number.test.ts:
error: Could not resolve: "~/number". Maybe you need to "bun install"?
import { displayMax } from "~/number"; ^
-> bun test
bun test v0.6.14 (\b5665739)
test/number.test.ts:
error: Could not resolve: "~/number". Maybe you need to "bun install"?
import { displayMax } from "~/number"; ^
Screenshot:
Additional information
I'm running bun in a pnpm monorepo