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

Make elfinfo work in the browser #2

Open
Ecco opened this issue May 20, 2022 · 4 comments
Open

Make elfinfo work in the browser #2

Ecco opened this issue May 20, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Ecco
Copy link

Ecco commented May 20, 2022

That's a pretty cool library, thanks for building it!

Small problem: it force-requires "fs" and "path". That prevents the code from loading in the browser.

Which is annoying, because the elfinfo actually runs really well in a browser. I made it work by adding this in Webpack:

  resolve: {
    fallback: {
      'path': false,
      'fs': false
    }

I think we should not need to do this hack, but instead elfinfo should only require fs and path when actually needed.

@Ecco
Copy link
Author

Ecco commented May 23, 2022

Actually here's a better webpack config for elfinfo in the browser.

resolve: {
  alias: {
    'string_decoder': false // Elfinfo will try and pull this, but doesn't really need it. Plus the behavior of string_decoder is sort of broken in the browser
  },
  fallback: {
    'path': false, // Elfinfo tries to pull path but doesn't really need it
    'fs': false, // Elfinfo also tries to use fs but doesn't really need it either
    'disassembler': false // Elfinfo wants to pull this, but we might not need to do any disassembly
  }
},

@cilliemalan
Copy link
Owner

Glad you think the library is cool! Making elfinfo work in the browser is a goal, however I have not had much time to work on it recently.

cilliemalan added a commit that referenced this issue May 24, 2022
@Ecco
Copy link
Author

Ecco commented May 24, 2022

Well, technically it does work in the browser. You just need to add some workarounds to prevent loading some node libraries, but if you do, it works pretty well.

I still do think those workaround should not be needed, especially because most of the work is already done in the library 😄

@cilliemalan
Copy link
Owner

Thanks for your feedback. I'll leave this issue open until I can get browser working properly.

@cilliemalan cilliemalan added the enhancement New feature or request label May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants