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

one more non-analyzable import #2231

Closed
sergeysedoy97 opened this issue May 6, 2022 · 3 comments
Closed

one more non-analyzable import #2231

sergeysedoy97 opened this issue May 6, 2022 · 3 comments

Comments

@sergeysedoy97
Copy link

e.g.

...
// Prevent React Native packager from seeing modules required with this
const nodeRequire = require;

function getRealmConstructor(environment) {
  switch (environment) {
    case "node.js":
    case "electron":
      return nodeRequire("bindings")("realm.node").Realm;
...

the binding module will not be bundled in this case.

@evanw
Copy link
Owner

evanw commented May 7, 2022

If you obfuscate require like this to prevent it from being detected, then it will not be detected. This is not a bug with esbuild.

@sergeysedoy97
Copy link
Author

Is it possible to detect such assignments and replace them?

@evanw evanw closed this as completed in 8c83fdf Jun 2, 2022
@evanw
Copy link
Owner

evanw commented Jun 2, 2022

I have added a way to detect code like this, which will be in the next release.

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