bun
bun copied to clipboard
Implement package.json `"#imports"` field support
ref: https://nodejs.org/api/packages.html#imports
Any ETA on this one?
I would guess this is a big blocker for a lot of people. All my Node.js packages are using #imports
so I can't try out Bun yet.
This is implemented and will soon be available in the canary build of bun:
bun upgrade --canary
@Jarred-Sumner Tried this on the latest (0.2.1) and it seems the issue is still there.
Any kind of flag needed, perhaps?
@Jarred-Sumner Doesn't seem to work in 0.2.2.
I couldn't get any #src/index.js
imports to work.
error: Could not resolve: "#src/index.js". Maybe you need to "bun install"?
import index from '#src/index.js'
"imports": {
"#src/*": {
"types": "./src/*.js",
"transpile": "./src/*",
"node": "./lib/*",
"bun": "./src/*.js"
}
},
{
"extends": "./node_modules/@live/scripts/tsconfig/tsconfig.json",
"compilerOptions": {
"rootDir": ".",
"baseUrl": "src",
"jsx": "react"
}
}
But I also use wildcards which I found isn't supported yet https://github.com/oven-sh/bun/issues/1402 <- probably good to wait for this one.
Also found this ticket https://github.com/oven-sh/bun/issues/1337, that indicated bun
subpath which is why I tried it above. Couldn't find docs on this.
Canary just upgraded to 0.2.3 now...the command didn't upgrade earlier...rechecking.
EDIT: Everything I try doesn't seem to work still...
I confirm that this is still an issue.
For example
import test from '#utils/test';
Will not work.
I guess that this has to do with extension resolution - e.g. test.js
might work.