mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
2602c4642b
Ensure that `defaultLoad` does not uselessly access the file system to get the source of modules that are known to be in CommonJS format. This allows CommonJS imports to resolve in the current phase of the event loop. Refs: https://github.com/eslint/eslint/pull/17683 PR-URL: https://github.com/nodejs/node/pull/50465 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
10 lines
277 B
JavaScript
10 lines
277 B
JavaScript
import '../common/index.mjs';
|
|
import fixtures from '../common/fixtures.js';
|
|
import assert from 'node:assert';
|
|
|
|
let tickDuringCJSImport = false;
|
|
process.nextTick(() => { tickDuringCJSImport = true; });
|
|
await import(fixtures.fileURL('empty.cjs'));
|
|
|
|
assert(!tickDuringCJSImport);
|