Skip to content

Support asynchronous dynamic import() - #1860

Merged
bnoordhuis merged 1 commit into
quickjs-ng:masterfrom
bnoordhuis:fix196
Oct 30, 2026
Merged

bnoordhuis merged 1 commit into
quickjs-ng:masterfrom
bnoordhuis:fix196

Conversation

@bnoordhuis

Copy link
Copy Markdown
Contributor

Keeps as the default the old behavior where import() is predominantly synchronous, but adds a new JSDynamicImportFunc callback that supports truly asynchronous module loading. In other words, it's opt-in and won't break existing users.

Fixes: #196


The bulk of the diff are tests and one long-ass comment in quickjs.h.

Keeps as the default the old behavior where `import()` is predominantly
synchronous, but adds a new `JSDynamicImportFunc` callback that supports
truly asynchronous module loading. In other words, it's opt-in and won't
break existing users.

Fixes: quickjs-ng#196

@saghul saghul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@bnoordhuis

Copy link
Copy Markdown
Contributor Author

#1522 has discussion on import.defer() but I decided to punt on that. Not that it's impossible to add, just that it's not worth agonizing over yet, IMO.

@bnoordhuis
bnoordhuis merged commit d4cd8f4 into quickjs-ng:master Oct 30, 2026
128 checks passed
@bnoordhuis
bnoordhuis deleted the fix196 branch October 30, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make dynamic import actually async

2 participants