Skip to content

module: ensure successful dynamic import returns the same result

According to https://tc39.es/ecma262/#sec-HostLoadImportedModule, if import() is called multiple times with the same (referrer, specifier) pair, then it must fulfil return the same object (or reject). https://tc39.es/proposal-import-attributes/#sec-HostLoadImportedModule takes it further by adding assertions attributes to the mix.

This PR adds a cache layer for dynamic imports to ensure Node.js meets the spec. EDIT: I should clarify here that the cache layer is also populated by static imports

Merge request reports

Loading