generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Node.js started out with an asynchronous resolve hook and it was learnt through hard experience that this is the wrong design for a number of reasons - performance, sync import use cases, usability.
Resolve hooks on the web being sync is likely also a strong requirement to remain for browser implementers I would assume.
I would like to therefore suggest a separation into two hooks that allow for layering here:
importHook: This hook gets called for both dynamic import andglobal.import()(if we were to have such a function). It is async but does not run for dependency modules. It is the job of this hook to ensure all sources for dependency modules are available by pre-resolving all modules and ensuring they are cached.resolveHook: With the import hook layering the async aspects, the resolve hook can always be called synchronously.
This is not a Stage 1 concern - but writing it up now to be clear that this would be a Stage 2 concern for me.
Metadata
Metadata
Assignees
Labels
No labels