We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbf1ed7 commit 972d921Copy full SHA for 972d921
lib/internal/errors.js
@@ -1459,8 +1459,8 @@ E('ERR_REQUIRE_ESM',
1459
return msg;
1460
}
1461
const path = require('path');
1462
- const basename = path.basename(filename) === path.basename(parentPath) ?
1463
- filename : path.basename(filename);
+ const basename = parentPath && path.basename(filename) ===
+ path.basename(parentPath) ? filename : path.basename(filename);
1464
if (hasEsmSyntax) {
1465
msg += `\nInstead change the require of ${basename} in ${parentPath} to` +
1466
' a dynamic import() which is available in all CommonJS modules.';
0 commit comments