mwright
mwright
DDeno
Created by mwright on 4/30/2024 in #help
StaticModuleLoader: why must the ModuleSpecifier be a URL?
hey everyone, I'm trying to pass a StaticModuleLoader to my runtime to enable specific imports. Each module for the StaticModuleLoader is specified by a ModuleSpecifier (type alias for url::Url) and the corresponding code (impl IntoModuleCodeString). I'm wondering why the module has to be specified by a url. I read here https://choubey.gitbook.io/internals-of-deno/foundations/resolve_url_or_path that the url is crucial because it allows Deno to locate and access the modules. But I'm already providing the code in form of the value that implements IntoModuleCodeString. If I want to enable an import such as import foo from "bar"; in the code that runs on the runtime, what would the ModuleSpecifier url look like that I have to pass to the StaticModuleLoader? Thank you!
3 replies