Skip to content

Commit b3112b9

Browse files
committed
fixup! esm: improve ERR_REQUIRE_ASYNC_MODULE
1 parent d64ed79 commit b3112b9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/internal/modules/esm/module_job.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function getTopLevelAwaitLocations(root) {
224224
if (typeof source !== 'string') { continue; } // Not retained during compilation. Skip.
225225
const found = findTopLevelAwait(source);
226226
if (found.length === 0) { continue; }
227-
const lines = StringPrototypeSplit(source, '\n');
227+
const lines = StringPrototypeSplit(source, /\r?\n/);
228228
for (let j = 0; j < found.length; j++) {
229229
const { start } = found[j].loc;
230230
ArrayPrototypePush(locations, {

test/es-module/test-require-module-tla-print-execution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const fixtures = require('../common/fixtures');
2424
// The immediately required module is shown regardless of the flag.
2525
assert.match(output, /Required module: .*tla[/\\]execution\.mjs/);
2626
// The location of the top-level await is shown with a caret.
27-
assert.match(output, /tla\/execution\.mjs:3/);
27+
assert.match(output, /tla[/\\]execution\.mjs:3/);
2828
assert(output.includes("await Promise.resolve('hi');\n^"), output);
2929
return true;
3030
},

0 commit comments

Comments
 (0)