Ask questionsProblems with metro bundler

For some weird reason metro bundler does not work properly. When I ran the "npm run bundler" to generate bundled file, it works fine without any warnings. But when I run it on the device it threw an error "util.inherits is not a function". Although, my node app works completely fine when I am running webpack to bundle.

How to reproduce

  • just bundle the following code and try running it on ios
const dht = require("@hyperswarm/dht");
const crypto = require("crypto");
const { LiquidCore } = require("liquidcore");

// A micro service will exit when it has nothing left to do.  So to
// avoid a premature exit, set an indefinite timer.  When we
// exit() later, the timer will get invalidated.
setInterval(() => {}, 10000);

console.log("Hello, World!");

// Listen for a request from the host for the 'ping' event
LiquidCore.on("ping", () => {
  // When we get the ping from the host, respond with "Hello, World!"
  // and then exit.
  LiquidCore.emit("pong", { message: "Hello, there" });

// Ok, we are all set up.  Let the host know we are ready to talk

const node = dht({
  // just join as an ephemeral node
  // as we are shortlived
  ephemeral: true,

const topic = crypto

// announce a port

node.unannounce(topic, { port: 12345 }, function (err) {
  if (err) throw err;

  console.log("began announcing");

If you need help with this let me know


Answer questions ericwlange

Which version of LiquidCore are you using? There was definitely a problem using the metro bundler with the minifier turned on, which is the default for bundling. I turned it off by default in one of the latest releases. Can you confirm that the bundle is not minified?


Related questions

No questions were found.
Eric Lange ericwlange Joonko Berlin, Germany CTO/CPO @ Former CPO @ Delivery Hero AG; product at Google, Yahoo, Flipkart, Microsoft, et al
Github User Rank List