loaders icon indicating copy to clipboard operation
loaders copied to clipboard

Will (ambient) loaders have access to synchronous import.meta.resolve?

Open cspotcode opened this issue 3 years ago • 1 comments

This is a potential gotcha I have on my to-do list to ask about.

Loaders cannot block their own thread with import.meta.resolve calls, so that will somehow need to be addressed in the design.

A loader author may be perfectly happy to deal with this limitation. However, if a loader attempts to import a (transitive) dependency that wants to call import.meta.resolve, that code will fail.

I'm not saying I have a magical solution to this problem, just that it probably should be called out in the design as a known limitation.

cspotcode avatar Jul 23 '22 15:07 cspotcode

I guess at least at first, calls to import.meta.resolve from within a loaders context could just throw an error.

GeoffreyBooth avatar Jul 24 '22 00:07 GeoffreyBooth

This is apparently not possible as it creates a viscous cycle.

Closing, but feel free to re-open if there's something to be done about that 🙂

JakobJingleheimer avatar Jun 20 '23 12:06 JakobJingleheimer