Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement package.json "#imports" field support #478

Closed
Jarred-Sumner opened this issue Jul 9, 2022 · 9 comments
Closed

Implement package.json "#imports" field support #478

Jarred-Sumner opened this issue Jul 9, 2022 · 9 comments
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs

Comments

@Jarred-Sumner
Copy link
Collaborator

No description provided.

@Jarred-Sumner Jarred-Sumner added enhancement New feature or request node.js Compatibility with Node.js APIs labels Jul 9, 2022
@Mouvedia
Copy link

Mouvedia commented Aug 6, 2022

@phaistonian
Copy link

Any ETA on this one?

@vjpr
Copy link
Contributor

vjpr commented Sep 19, 2022

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.

@Jarred-Sumner
Copy link
Collaborator Author

This is implemented and will soon be available in the canary build of bun:

bun upgrade --canary

@phaistonian
Copy link

@Jarred-Sumner Tried this on the latest (0.2.1) and it seems the issue is still there.

Any kind of flag needed, perhaps?

@vjpr
Copy link
Contributor

vjpr commented Nov 9, 2022

@Jarred-Sumner Doesn't seem to work in 0.2.2.

@vjpr
Copy link
Contributor

vjpr commented Nov 9, 2022

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 #1402 <- probably good to wait for this one.

Also found this ticket #1337, that indicated bun subpath which is why I tried it above. Couldn't find docs on this.

@vjpr
Copy link
Contributor

vjpr commented Nov 9, 2022

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...

@phaistonian
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

4 participants