Skip to content
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

hasDynamicImport with eval dynamic import #14

Closed
legendecas opened this issue Jun 7, 2024 · 7 comments
Closed

hasDynamicImport with eval dynamic import #14

legendecas opened this issue Jun 7, 2024 · 7 comments

Comments

@legendecas
Copy link
Member

Could AbstractModuleSource.prototype.hasDynamicImport determinisitically be true if the module contains dynamic imports via eval?

@guybedford
Copy link
Collaborator

This is a great point, thanks. This may be justification to remove this feature, I'll post a PR.

@Jack-Works
Copy link
Member

In this case, the dynamic import will have no context (for resolving a relative module) IMO. I don't want this feature to be removed.

@guybedford
Copy link
Collaborator

In Node.js, I get the following:

subfolder/mod.mjs

eval("import('./dep.mjs')");

Attempting to load subfolder/dep.mjs. So the context works fine I believe?

@Jack-Works
Copy link
Member

I also tried this and dug into the spec. Yes, it will have the context, even indirect eval works, so it's ok to remove hasDynamicImport

@guybedford
Copy link
Collaborator

Thanks for the follow-up. Since it is so close to the meeting, I will leave the PR open for now.

@legendecas
Copy link
Member Author

It depends on if the eval is a direct eval. If it is an indirect eval, it depends on whether the host propagates the active script properly (actually, it's not tc39/ecma262#3195).

@guybedford
Copy link
Collaborator

Removed in #15.

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

No branches or pull requests

3 participants