also in Script, or just Module?
ljharb opened this issue · 7 comments
import()
works in both Scripts and Modules. Should asset
work in Scripts, for the same reasons?
Good question. I think there is an interesting overlap with import maps. Particularly “import:” URLs or something like it. The larger story around how URLs will work in the larger web platform can be informative of how it could work in scripts.
if this syntax works in a way that requires IO/async ops to perform resolution before starting code evaluation I don't think this would work for Scripts since they are expected for run synchronously.
I would assume the synchronous form is not available in Scripts, but the asynchronous one should work, just like import()
does.
@ljharb is this mostly about consistency? If the location operations are not timed specifically we can still produce the reference synchronously.
Yes, I think a lack of consistency will be confusing, including in terms of thinking about the phases in ESM.
including in terms of thinking about the phases in ESM.
Can you explain how these values are directly tied in part to the phases of ESM?
With static forms, i expect that all imports are fully resolved and valid before any actual code evaluates. import ‘nonexistent’
throws before anything is evaluated; I’d expect asset from ‘nonexistent’
to do the same.