import.meta.resolve(specifier) returns the URL to which the given specifier would resolve in the context of the current script. That is, it returns the URL that would be imported if you did import(specifier).
This feature has low interoperability and compatibility risk. Both Gecko and Safari are supportive, and it should be easy for all engines to implement. It is also quite simple and unlikely to change in the future. If it needs future extension, we can add an options bag as the second argument.
This API will often be used in tandem with APIs to fetch the associated URL. It is also especially useful on pages that use import maps. This API will not make it hard for Chrome to maintain good performance. It exposes an existing simple algorithm, which if web developers were to emulate would involve lots of extra work on their part to parse the relevant import maps.
Polyfills for this feature would mostly take the form of module bundlers rewriting import.meta.resolve() calls, or possibly injecting `import.meta.resolve = ...` at the top of each module.
None. This exposes only information and code paths that were already available via more indirect means.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
No special support needed.
No milestones specified
Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/a3c6636e-3255-449b-ba9f-96c8c308b6ben%40chromium.org.
LGTM3
/Daniel
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/a0d49eb8-174c-6f5a-a1ea-535149226520%40chromium.org.