This reduces the impact of https://redirect.github.com/nodejs/node/pull/59679 by delaying the require.cache population of ESM until they are directly required. After that, it's necessary for them to be in the cache to maintain correctness. PR-URL: https://github.com/nodejs/node/pull/59874 Refs: https://github.com/nodejs/node/issues/59868 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
9 lines
224 B
JavaScript
9 lines
224 B
JavaScript
const path = require('path');
|
|
|
|
const name = require('./esm.mjs').name;
|
|
exports.name = name;
|
|
|
|
const filename = path.join(__dirname, 'esm.mjs');
|
|
const cache = require.cache[filename];
|
|
exports.cache = require.cache[filename];
|
|
|