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

Cannot publish jsr package using bun:-import specifier, error: invalidexternalimport #26989

Closed
Hexagon opened this issue Nov 21, 2024 · 2 comments · Fixed by #24588
Closed

Cannot publish jsr package using bun:-import specifier, error: invalidexternalimport #26989

Hexagon opened this issue Nov 21, 2024 · 2 comments · Fixed by #24588

Comments

@Hexagon
Copy link

Hexagon commented Nov 21, 2024

Version: Deno 1 , 2 and 2.1

Long running issue... I'm trying to publish @cross/test to jsr. This library does a conditional import of bun:test if running Bun, and this error pops up while trying to publish - https://jsr.io/docs/troubleshooting#invalidexternalimport

The code is dynamically imported, so it would never execute in Deno

} else if (CurrentRuntime == Runtime.Bun) {
  const { wrappedTest } = await import("./shims/bun.ts");

... and the actual problem is in ./shims/bun.ts (which again is conditionally imported):

import { test } from "bun:test";
// ...

I originally posted this in as an issue in jsr-io/jsr (jsr-io/jsr#599) , but have figured out that the problem may live in Deno itself:

An outdated error message (as bun-specifiers should be supported by now):

Cow::Borrowed("jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers"),

And a function potentially missing a case for bun::

pub fn collect_diagnostics_for_graph(

@Hexagon Hexagon changed the title Cannot publish package using bun: import specifier: invalidexternalimport Cannot publish jsr package using bun: import specifier: invalidexternalimport Nov 21, 2024
@Hexagon Hexagon changed the title Cannot publish jsr package using bun: import specifier: invalidexternalimport Cannot publish jsr package using bun:-import specifier, error: invalidexternalimport Nov 21, 2024
@bartlomieju
Copy link
Member

It appears that this would be solved by #24588, but not sure if that PR is landable.

@nathanwhit
Copy link
Member

Seems like it could be landed if someone picks it up, just needs to be rebased and CI failures fixed

bartlomieju pushed a commit that referenced this issue Nov 28, 2024
Fixes #26989

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants