Skip to content

fix: use __glob_dynamic for dynamic import #4153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

suguanYang
Copy link

@suguanYang suguanYang commented Apr 22, 2025

This fix #3980 by provides a different glob function: __glob_dynamic which returns a rejected promise.

Reference:
https://tc39.es/ecma262/#sec-import-calls

The host environment must perform FinishLoadingImportedModule(referrer, moduleRequest, payload, result), where result is either a normal completion containing the loaded Module Record or a throw completion, either synchronously or asynchronously.

@suguanYang
Copy link
Author

Actually the current synchronous behavior is similar to nodejs, should we respect the specification or the host platform?

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.

ESM dynamic import to glob imports, throw synchronous error
1 participant