#746: import.meta.resolve()

Visit on Github.

Opened Jun 6, 2022

Wotcher TAG!

I'm requesting a TAG review of import.meta.resolve().

import.meta.resolve(specifier) returns the URL to which 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 is a quite small feature (a single function, with only a few lines of spec text which exposes an already-existing spec algorithm).

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines: Chrome would like to ship this within a few weeks.
  • The group where the work on this specification is currently being done: WHATWG
  • Major unresolved issues with or opposition to this specification: There was some opposition from Node.js about how synchronous semantics would conflict with their existing experimental async semantics; see the discussion in the explainer. I believe these have been largely resolved.
  • This work is being funded by: Google

We'd prefer the TAG provide feedback as (please delete all but the desired option):

💬 leave review feedback as a comment in this issue and @-notify @domenic

Discussions

2022-07-18

Minutes

Lea: seems very incremental - something developers do frequently - pretty small feature, small abstraction.

Peter: Looking at the "sync vs async" discussion in the explainer. Whether import maps are loaded or not.

Lea: supposed to be syntactic sugar for what devs are doing already which is sync. So tending to agree with Domenic.

Peter: wonder if import maps haven't loaded yet what's the behavior? would you get an answer that's wrong?

Dan: leave that as a comment / question?

Peter: i can leave the comment.

Peter: [in the issue] a lot of background to the sync vs async decision. Seems like a lot of other dependencies on this. Not sure it's a simple thing.

2022-08-22

Minutes

can we progress it this week?

Peter: another sync vs. async feedback... To me this feels like - it makes sense to have it sync now but we'll probably regret it at some point.

Dan: is it satisfied with concerns? Or not resolved?

Peter: I don't know. Need Lea's feedback as well.

bumped to next week

2022-08-29

Minutes

punt to plenary

2022-10-31

Minutes

Dan: talked about this with Chris H. He wanted to know what he could do to help nudge this. Should we close it, or push more?

Lea: the issue is that this wouldn't work for externally loaded import maps which we don't yet have right?

Peter: yeah

Lea: but can you dynamically create a script element and append it with an import map? Then you have the same issue of import maps being created afterwards. If that works, and if you can create importa mpas at any point in time, even if this was async it still wouldn't account for that. So maybe it's okay that it's syntactic sugar over what authors can do already and therefore it's sync?

Peter: leaning toward it just being sync, a snapshot of the current state. TC39 already dealing with this. node shipped an async version and they're changing over to a sync version. I don't think we were complaining about it being sync, I think we were just curious about some behavioural issues.

Lea: looks like we're okay with this being sync? [leaves closing comment]

agreement to close