From a6b030d5ac2c4a2d34f6b9eb3f945d252a42843e Mon Sep 17 00:00:00 2001 From: Bradley Farias Date: Mon, 30 Sep 2019 14:55:59 -0500 Subject: module: refactor modules bootstrap PR-URL: https://github.com/nodejs/node/pull/29937 Reviewed-By: Myles Borins Reviewed-By: Joyee Cheung --- lib/internal/bootstrap/loaders.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/internal/bootstrap/loaders.js') diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 775fea064e..48afed2556 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -220,7 +220,10 @@ NativeModule.prototype.compileForPublicLoader = function(needToSyncExports) { this.compile(); if (needToSyncExports) { if (!this.exportKeys) { - this.exportKeys = Object.keys(this.exports); + // When using --expose-internals, we do not want to reflect the named + // exports from core modules as this can trigger unnecessary getters. + const internal = this.id.startsWith('internal/'); + this.exportKeys = internal ? [] : Object.keys(this.exports); } this.getESMFacade(); this.syncExports(); -- cgit v1.2.3