1) My understanding is that a module is a singleton. But how does the spec enforce that? Section 15.2.1.17 HostResolveImportedModule ( https://tc39.github.io/ecma262/#sec-hostresolveimportedmodule) says that the resolving process of a module must be indempotent. 'Each time it is called with a specific referencingModule, specifier pair as arguments it must return the same Module Record instance.'
But in the following scenario: main.js ```js import a from 'a.js'; import b from 'b.js'; ``` a.js ```js impot c from 'c.js'; console.log(c); ``` b.js ```js import c from 'c.js'; console.log(c); ``` c.js ```js export default 3; ``` can we be certain that c.js resolves to the same module record and that both a.js and b.js print 3? There are two different referencingModule, specifier pairs even though the specifier is the same. 2) Is it correct that it's mandatory for an implementation to produce different module instances in every TopLevelModuleEvaluationJobs? So if we have two script tags with type module and with the same script content will they always produce different module instances or is it possible for an implementation to produce modules without executing a TopLevelModuleEvaluationJob and reuse module instances?
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

