The module.syncBuiltinESMExports()
method updates all the live bindings for
builtin [ES Modules][] to match the properties of the [CommonJS][] exports. It
does not add or remove exported names from the [ES Modules][].
const fs = require('fs');
const { syncBuiltinESMExports } = require('module');
fs.readFile = null;
delete fs.readFileSync;
fs.newAPI = function newAPI() {
// ...
};
syncBuiltinESMExports();
import('fs').then((esmFS) => {
assert.strictEqual(esmFS.readFile, null);
assert.strictEqual('readFileSync' in fs, true);
assert.strictEqual(esmFS.newAPI, undefined);
});