denoland / denoland/deploy_feedback

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

Open
#821 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Problem description

Same issue as https://github.com/denoland/deno/issues/16089. Seems it was fixed in https://github.com/denoland/deno/pull/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:
```ts
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:
```ts
wasmUrl == 'file:///path/to/.cache/deno/npm/registry.npmjs.org/excelize-wasm/0.0.7/excelize.wasm.gz'
```
4. 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.