Closed askbeka closed 5 years ago
Sorry for the delay in answering this.
I think we have a tension in use cases here, between production and testing. Because testing environments have more tools and flexibility available to them (e.g. using iframes), I'd rather we leaned toward the production use cases served by the current spec's semantics.
That said, we are considering in the future a way of manipulating the import map programmatically, which could help with this sort of thing. See #128 to track that discussion.
I'll close this for now, but thanks for bringing it up, and sorry again about the delay.
@domenic Missed this one too:) Thanks. Will keep an eye
Reading through proposal and trying it out, I see that import-maps can be used for mocking modules, which can be very useful for testing. But since import-maps are parsed before any import and subsequent declarations will result in error being thrown, it is tricky to make use of it for testing (possible using iframes for example) unless there is a way to invalidate cached modules.
Maybe, subsequent importmaps decalrations would just invalidate the module cache instead of throwing an error?
I think import maps can be very usefull for this purpose and we will not need rewiremock like solutions. I am not sure if this usecase conflicts with ideas behind current proposal, what do you think?