DenoDDeno
Powered by
mwrightM
Denoβ€’2y agoβ€’
2 replies
mwright

StaticModuleLoader: why must the ModuleSpecifier be a URL?

hey everyone, I'm trying to pass a
StaticModuleLoader
StaticModuleLoader
to my runtime to enable specific imports.
Each module for the
StaticModuleLoader
StaticModuleLoader
is specified by a
ModuleSpecifier
ModuleSpecifier
(type alias for
url::Url
url::Url
) and the corresponding code (
impl IntoModuleCodeString
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
IntoModuleCodeString
.

If I want to enable an import such as
import foo from "bar";
import foo from "bar";
in the code that runs on the runtime, what would the
ModuleSpecifier
ModuleSpecifier
url look like that I have to pass to the
StaticModuleLoader
StaticModuleLoader
?

Thank you!
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Data must be valid JSON
isacedIisaced / help
3y ago
Deno debugging failure: Argument 0 must be a buffer source
j7m4Jj7m4 / help
3y ago
interaction_endpoint_url: couldn't be verified
alchemiztAalchemizt / help
3y ago