Skip to content

Commit

Permalink
fixup! module: include module information in require(esm) warning
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Oct 18, 2024
1 parent c748d5e commit 5a78db6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,8 @@ function loadESMFromCJS(mod, filename) {
from = 'The REPL';
} else if (from === '.') {
from = 'The entry point';
} else if (from) {
from = `CommonJS module ${from}`;
} else {
from &&= `CommonJS module ${from}`;
}
if (from && to) {
messageBefore = `${from} is loading ES Module ${to} using require().\n`;
Expand Down
2 changes: 1 addition & 1 deletion test/es-module/test-require-module-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ testPreload('--import');
},
{
stdout: /^package-type-module\s+A$/,
stderr: /ExperimentalWarning: --require is loading ES Module .*package-type-module\/index\.js using require/,
stderr: /ExperimentalWarning: --require is loading ES Module .*package-type-module[\\/]index\.js using require/,
trim: true,
}
);
Expand Down

0 comments on commit 5a78db6

Please sign in to comment.