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

direct eval warning when bundling with esbuild #31

Closed
leebenmorris opened this issue Oct 21, 2022 · 2 comments
Closed

direct eval warning when bundling with esbuild #31

leebenmorris opened this issue Oct 21, 2022 · 2 comments

Comments

@leebenmorris
Copy link

When building code for Cypress using esbuild and this plugin I get the following warning:

Warning: G] Using direct eval with a bundler is not recommended and may cause problems [direct-eval]

node-modules-polyfills:crypto:28833:9:
  28833 │   return eval((this || _global$b).code);
        ╵          ~~~~

You can read more about direct eval and bundling here: https://esbuild.github.io/link/direct-eval

Should I be concerned about this?

@imranbarbhuiya
Copy link
Owner

imranbarbhuiya commented Oct 21, 2022

This lib doesn't provide the source code of these modules. It depends on https://github.com/Aslemammad/modern-node-polyfills
which uses https://github.com/jspm/jspm-core I search their source code but can't find any usage of eval. I'll look into it.

Also, if u are bundling only for testing, ig you can ignore this warning, but this can cause issues for production bundles.

Can you give me a minimal repro of this issue?

Edit: last time I used GitHub search, it didn't show me the eval as the crypto file is too large. So this time I downloaded the file and found the code

  (Script.prototype.runInThisContext = function () {
    return eval((this || _global$b).code);
  }),

I'm not sure how to fix this as it's present in upstream code. If anyone has any idea about fixing this issue, then lmk

@imranbarbhuiya
Copy link
Owner

For now, I fixed in my lib and published v1.0.14, if it gets fixed in upstream, I'll revert my changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants