question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use with a bundler?

See original GitHub issue

Hey there,

thanks for providing this awesome module to the community! I am trying to get this package to work with Webpack & React, but it turns out to be quite the issue. I suspect it is because of the way that the argon2.js:

  1. Uses a factory and does not have a default export (webpack will bundle it in a scope which afaik is unaccessible afterwards), and
  2. Loads the asm-file from a node_modules folder which is supposed to be exposed (if I get this correctly)

I was able to get this to work with a bundler by copying both of these files, exposing the asm variant file, and then both adding a default export & changing the import path. Is there a way to get first hand support for bundlers so that this does not result in any issues? I suspect most people will not be willing to expose their node_modules, and I feel it is a really bad practice. On the other hand, my workaround will need to be updated manually, which might pose security risks at some point in time.

Would love to get your feedback on this!

Cheers

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
antellecommented, Jul 30, 2019

Done. Usage examples:

I used base64-loader because WebPack 4 is too smart and does some magic with WASM, however this magic doesn’t work with emscripten and it’s not possible to disable it, so I screwed it with base64-loader. If you manage to find another solution, please let me know.

1reaction
antellecommented, Jul 1, 2019

Hi! Indeed exposing node_modules is not cool and it’s supposed to be used mostly for debugging.
Now WebPack has better support for loading WebAssembly, we can improve bundling as well. I’d be happy to see a merge request on this, but I’ll also try to implement it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Bundler with Ruby
Bundler makes sure that Ruby can find all of the gems in the Gemfile (and all of their dependencies). If your app is...
Read more >
The Complete JavaScript Module Bundlers Guide - Snipcart
A bundler is a development tool that combines many JavaScript code files into a single one that is production-ready loadable in the browser....
Read more >
How JavaScript bundlers work - Medium
How JavaScript bundlers work · We can use the npm because require()/exports are implemented the same way than in Node. · You can...
Read more >
Module Bundler in JavaScript – How to Use Webpack
Module bundlers allow browsers to access the file you specified in a require() or import statement. In other words, suppose a browser runs...
Read more >
Let's learn how module bundlers work and then write one ...
A module bundler is a tool that takes pieces of JavaScript and their dependencies and bundles them into a single file, usually for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found