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

Specifying dynamic import dependencies #201

Closed
kitsonk opened this issue Mar 5, 2024 · 3 comments · Fixed by #230
Closed

Specifying dynamic import dependencies #201

kitsonk opened this issue Mar 5, 2024 · 3 comments · Fixed by #230
Labels
publishing Problems with publishing

Comments

@kitsonk
Copy link

kitsonk commented Mar 5, 2024

To provide compatibility under Bun and Node.js for one of my projects, I need to dynamically import a polyfill in those environments and I can't seem to get the publish to identify that as a dependency.

I have tried adding it to the import map and even included a package.json as part of the project, and while the dependency is resolved locally with the Deno CLI, it is not detected on publish, and therefore on consumption the dependency is not there.

There should be a way to specify dependencies that does not get elided upon "incorrect" static analysis.

@github-project-automation github-project-automation bot moved this to Needs Triage in JSR Mar 5, 2024
@lucacasonato
Copy link
Member

How are you including it?

await import("specifier") should be working

@kitsonk
Copy link
Author

kitsonk commented Mar 6, 2024

It is in a conditional block:

if (!("URLPattern" in globalThis)) {
  await import("urlpattern-polyfill");
}

I tried with npm:urlpattern-polyfill, adding to the import map in deno.json and adding to the package.json and in each case they either don't get detected or elided.

The version 0.5.1-alpha.4, 0.5.1-alpha.3 and 0.5.1-alpha.2 all contain the various forms that don't include the dependency when consumed via Node.js or Bun.

@lucacasonato
Copy link
Member

Gee, yeah that looks like a bug. Will fix tomorrow

@lucacasonato lucacasonato moved this from Needs Triage to Ready in JSR Mar 6, 2024
@lucacasonato lucacasonato added bug publishing Problems with publishing labels Mar 6, 2024
@github-project-automation github-project-automation bot moved this from Ready to Done in JSR Mar 7, 2024
kitsonk added a commit to oakserver/acorn that referenced this issue Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
publishing Problems with publishing
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants