Deno compile tries to resolve wasm imports for explicitly instantiated modules
Version: Deno 2.5.6
Trying to compile a workspace with wasm files, encountering the error:
error: Import "dom" not a dependency and not in import map from "file:///......../_fresh/59458a871d2aa5b4360d.wasm"
Wasm imports should not be resolved in any way here, as they are always passed explicitly in WebAssembly.instantiate:
WebAssembly.instantiateStreaming(fetch(new URL("wasmFile.wasm", import.meta.url)), {
dom: ...
})
Are you using source phase imports? If so, this would be the same issue as #31240.
I'm not even importing wasm using import statement, in code it is used by WebAssembly.instantiate(fetch(...))
Oh, got it, so using --include it is still being analyzed as wasm module imported using import statement
Should it then be safe to not add it to the module roots by default, as it would be automatically added by any import if it exists?
It is only broken with deno compile, and works normally otherwise.
Related: https://github.com/denoland/deno/issues/27505