Skip to content

Commit 5ff1e67

Browse files
joyeecheungtargos
authored andcommittedNov 2, 2018
lib: fix code cache generation
e7f710c broke the code cache generation since internalBinding is now passed in through the wrapper and cannot be redeclared. This patch fixes that. Refs: #21563 PR-URL: #23855 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 164f244 commit 5ff1e67

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎lib/internal/bootstrap/cache.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
// cannot be tampered with even with --expose-internals
77

88
const {
9-
NativeModule, internalBinding
9+
NativeModule
1010
} = require('internal/bootstrap/loaders');
11+
const { hasTracing } = process.binding('config');
1112

1213
function getCodeCache(id) {
1314
const cached = NativeModule.getCached(id);
@@ -42,6 +43,16 @@ const cannotUseCache = [
4243
'internal/bootstrap/node'
4344
].concat(depsModule);
4445

46+
// Skip modules that cannot be required when they are not
47+
// built into the binary.
48+
if (process.config.variables.v8_enable_inspector !== 1) {
49+
cannotUseCache.push('inspector');
50+
cannotUseCache.push('internal/util/inspector');
51+
}
52+
if (!hasTracing) {
53+
cannotUseCache.push('trace_events');
54+
}
55+
4556
module.exports = {
4657
cachableBuiltins: Object.keys(NativeModule._source).filter(
4758
(key) => !cannotUseCache.includes(key)

0 commit comments

Comments
 (0)