From f977673784268b582a712f8f5ddc54e9b11c1962 Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Sun, 8 Dec 2024 15:50:40 -0500 Subject: [PATCH] Add new error text to recognize ESM-only imports This error message was added in Node.js 22.0.0: https://github.com/npm/node/commit/5f7fad26050cd574431e3018a557bc6eae5ff716 --- src/config/pragmas/plugins.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/pragmas/plugins.js b/src/config/pragmas/plugins.js index 71bbc69..3e304be 100644 --- a/src/config/pragmas/plugins.js +++ b/src/config/pragmas/plugins.js @@ -152,6 +152,7 @@ function resolve (path, cwd) { } let esmErrors = [ + 'require() cannot be used on an ESM graph with top-level await. Use import() instead.', 'Cannot use import statement outside a module', `Unexpected token 'export'`, 'require() of ES Module',