From 5fa7b2ae81220e701215537950e09655d3ecf887 Mon Sep 17 00:00:00 2001 From: bn-l Date: Tue, 19 Mar 2024 16:19:39 +1100 Subject: [PATCH] Updated error code to work with ESM modules (see: https://github.com/nodejs/modules/issues/360). Added message about the env var. --- src/reconciler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/reconciler.ts b/src/reconciler.ts index d0bdad29..ef07f9a6 100644 --- a/src/reconciler.ts +++ b/src/reconciler.ts @@ -26,10 +26,11 @@ if (process.env['DEV'] === 'true') { try { await import('./devtools.js'); } catch (error: any) { - if (error.code === 'MODULE_NOT_FOUND') { + if (error.code === 'ERR_MODULE_NOT_FOUND') { console.warn( ` -Debugging with React Devtools requires \`react-devtools-core\` dependency to be installed. +The environment variable DEV = true so ink tried to import \`react-devtools-core\` but this +failed as it was not installed. Debugging with React Devtools requires it. To install use this command: $ npm install --save-dev react-devtools-core `.trim() + '\n'