WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.68k stars 69 forks source link

plv8 + import maps #172

Closed erichanson closed 4 years ago

erichanson commented 5 years ago

I've been following import maps with much interest. I'm coming from the plv8 perspective, thinking about how to make them work in that environment. It's a special environment, since plv8 does not have access to either the filesystem or HTTP requests, since it is a trusted language. And landed upon this perspective:

Wouldn't it be more flexible and less opinionated, if import maps used lambdas instead of URL remapping and/or string rewriting? I would like import maps to be a "resolver lambda" that accepted a "import from x" string, and was responsible for turning x into a block of source code. This way the developer could control how dependencies were resolved, and have total control over the resolution mechanism.

domenic commented 5 years ago

Did you see https://github.com/WICG/import-maps#a-programmable-resolution-hook?