Skip to content

fix: handle dynamic imports with module aliases #7452

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: master
Choose a base branch
from

Conversation

cristianoc
Copy link
Collaborator

Fixes #7403

When a module containing an alias (e.g. module VS = VariantSpreads) is dynamically imported, the compiler now correctly extracts the original module identifier from the Llet expression.

Fixes #7403

When a module containing an alias (e.g. `module VS = VariantSpreads`) is
dynamically imported, the compiler now correctly extracts the original
module identifier from the Llet expression.
@cristianoc cristianoc force-pushed the dynamic-import-module-with-alias branch from cc6459e to cf92334 Compare May 9, 2025 12:10
@@ -442,6 +442,22 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) :
in
Lam.function_ ~attr ~arity:(List.length params) ~params
~body:(convert_aux body)
| Llet (_, _, _, Lprim (Pgetglobal id, args, _), _body) when dynamic_import
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mununki is this the correct way to handle the case?

@cristianoc cristianoc requested a review from mununki May 9, 2025 12:11
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.

Dynamic module import errors
1 participant