-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Replace eval with indirect eval #23483
base: main
Are you sure you want to change the base?
Conversation
Indirect eval doesn't expose the local scope to the evaluated code, and won't warn as much from bundlers
Unfortunately I think indirect eval does not suffice. For instance if you use Maybe we could have a mode where we pass |
Wdyt @sbc100? I see you didn't express a concern about this in the linked issue... |
See in ci there are many errors like:
I think the bundler warnings may be an acceptable evil and assuming that people test the output they can find out whether the bundler broke anything or not. For many projects it's necessary to disable minification. |
It might still be possible to pass the needed references in for the code to use. Instead of exposing the entire scope of the module. But I'm not sure what is expected to be defined by the eval-ed code. |
Unfortunately what's expected is... everything defined on the module. We could add a compiler setting |
I don't think that works either, because the |
Perhaps some of the uses of in this PR can still land, even if EM_JS is not one of them? |
Indirect eval doesn't expose the local scope to the evaluated code, and won't warn as much from bundlers
Fixes #23464