vadimdemedes/ink

Hangs while react is trying to connect to react dev tools / not exiting

bn-l opened this issue · 0 comments

bn-l commented

Ink (via react) will hang as it tries to connect to dev tools.

Currently ink will try and load react dev tools if the env var "DEV" is set to "true" (note: not NODE_ENV or INK_ENV--which makes it easy to accidentally have this flag flipped).

If dev tools is not installed (it's an optional peer dependency) then ink will crash (with, imo, an uninformative message).

If it is installed and react cannot find the dev tools server (or whatever), then it will begin retrying using an exponential back up. As a result ink will very likely either hang or crash.

I'm a little surprised there isn't an issue already on this in particular.

My fix for this is the following:

  const test = async() => {
      
      const saved = process.env["DEV"];
      process.env["DEV"] = "false";
      const tui = await import("./inkTUI.mjs");
      process.env["DEV"] = saved;
      return tui;
  };
  const tui = await test();

Yes.