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][].

    1. const fs = require('fs');
    2. const { syncBuiltinESMExports } = require('module');
    3. fs.readFile = null;
    4. delete fs.readFileSync;
    5. fs.newAPI = function newAPI() {
    6. // ...
    7. };
    8. syncBuiltinESMExports();
    9. import('fs').then((esmFS) => {
    10. assert.strictEqual(esmFS.readFile, null);
    11. assert.strictEqual('readFileSync' in fs, true);
    12. assert.strictEqual(esmFS.newAPI, undefined);
    13. });