You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understand this request, I think it's something I'd also be interested in.
Currently, we register our module loading callback using JS_SetModuleLoaderFunc. We need to return a *JSModuleDef which requires that we JS_Eval2 the source of the module.
V8 uses a distinct callback for dynamic modules, SetHostImportModuleDynamicallyCallback, which expects a promise to be returned. This makes a lot of sense to me, because loading a dynamic module shouldn't itself be blocking. It also makes it easier to integrate with nonblocking I/O, because we can associate the Promise with our nonblocking I/O operation and, on completion, resolve the promise.
Some websites do hundreds of dynamic async imports, and I'm having a hard time figuring out how to do this efficiently in QuickJS.
Activity
saghul commentedon Dec 10, 2023
Please don't open a new issue. Keep the discussion on #191.
bnoordhuis commentedon Dec 10, 2023
I asked him to open a new issue because dynamic import is different from regular import.
edit: that said, the conclusion may still be that we're not going to change anything.
saghul commentedon Dec 10, 2023
Ops my bad! Understood.
karlseguin commentedon Oct 17, 2025
If I understand this request, I think it's something I'd also be interested in.
Currently, we register our module loading callback using JS_SetModuleLoaderFunc. We need to return a *JSModuleDef which requires that we JS_Eval2 the source of the module.
V8 uses a distinct callback for dynamic modules, SetHostImportModuleDynamicallyCallback, which expects a promise to be returned. This makes a lot of sense to me, because loading a dynamic module shouldn't itself be blocking. It also makes it easier to integrate with nonblocking I/O, because we can associate the Promise with our nonblocking I/O operation and, on completion, resolve the promise.
Some websites do hundreds of dynamic async imports, and I'm having a hard time figuring out how to do this efficiently in QuickJS.
Support asynchronous dynamic import() (#1860)