Open Deepp0925 opened 4 years ago
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?
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
// 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 LiquidCore.emit("ready");
const node = dht({ // just join as an ephemeral node // as we are shortlived ephemeral: true, });
const topic = crypto .createHash("sha256") .update("Some-Random-Channel") .digest();
// announce a port
node.unannounce(topic, { port: 12345 }, function (err) { if (err) throw err;
console.log("began announcing"); });