ethereumjs/ethereumjs-blockchain

This library doesn't run in the browser

alcuadrado opened this issue · 3 comments

As reported in ethereumjs/ethereumjs-monorepo#517, this library can't run in the browser because it uses util.callbackify.

This library is browserifyable as is. The actual problem is in ethereumjs-vm, as karma-browserify is behaving differently than browserify.

Hmm, the associated PR browserify/node-util#25 over on the browserify library has been merged, but the code from the util library doesn't seem to be integrated in the main browserify package yet, not sure why this is working?

This library is using another version of util, installed from npm. That's why it works when browserifying it here.

The problem is that browserify gets lost when browserifying this as a dependency. It probably has to do with the dependency having the same name as a core module. Apparently browserify is using its builtin replacement in that case, which doesn't include callbackify.

As a temporal measure, I imported the code of callbackify, tested it in the VM and everything works. I'll open a PR with that change.