Skip to content

[Bug]: "npm:" specifiers are currently not supported in import.meta.resolve() #821

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

Open
lionel-rowe opened this issue Feb 25, 2025 · 0 comments

Comments

@lionel-rowe
Copy link

lionel-rowe commented Feb 25, 2025

Problem description

Same issue as denoland/deno#16089. Seems it was fixed in denoland/deno#21716 for Deno proper, but still affects Deploy.

EDIT: This only affects literal npm: specifiers, not NPM imports that use the import map. So impact is low for deployments via GitHub, but seems there's no workaround for playground projects.

Steps to reproduce

  1. Try to use import.meta.resolve with an npm: specifier. For example:
    const wasmUrl = new URL('excelize.wasm.gz', import.meta.resolve('npm:excelize-wasm'))
  2. Observe expected result in Deno running locally, something like the following:
    wasmUrl == 'file:///path/to/.cache/deno/npm/registry.npmjs.org/excelize-wasm/0.0.7/excelize.wasm.gz'
  3. Observe error in Deno Deploy:
    TypeError: "npm:" specifiers are currently not supported in import.meta.resolve()
    

Repro: https://dash.deno.com/playground/excelize-wasm-demo

Expected behavior

Consistent behavior with local Deno, allowing for easy resolving of WASM imports

Environment

navigator.userAgent is Deno/2.1.9

Possible solution

No response

Additional context

No response

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

No branches or pull requests

1 participant