mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 22:28:51 +02:00

Previously there is an edge case where submodules loaded by require() may not be loaded by import() again from different intermediate edges in the graph. This patch fixes that, added tests, and added debug logs. Drive-by: make loader a private field so it doesn't show up in logs. PR-URL: https://github.com/nodejs/node/pull/52487 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
14 lines
501 B
JavaScript
14 lines
501 B
JavaScript
// Flags: --experimental-require-module
|
|
'use strict';
|
|
|
|
// This tests that previously asynchronously loaded submodule can still
|
|
// be loaded by require().
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
(async () => {
|
|
const imported = await import('../fixtures/es-modules/require-and-import/load.mjs');
|
|
const required = require('../fixtures/es-modules/require-and-import/load.cjs');
|
|
assert.deepStrictEqual({ ...required }, { ...imported });
|
|
})().then(common.mustCall());
|