Don't patch Module without preload cache
This commit is contained in:
parent
9687aee2ca
commit
390eab2556
1 changed files with 52 additions and 50 deletions
|
@ -71,6 +71,7 @@ const ModuleInternals = Module as unknown as {
|
|||
_extensions: unknown;
|
||||
};
|
||||
|
||||
if (cachedData || process.env.GENERATE_PRELOAD_CACHE) {
|
||||
const previousModuleCompile = ModuleInternals.prototype._compile;
|
||||
ModuleInternals.prototype._compile = function _compile(
|
||||
content: string,
|
||||
|
@ -124,6 +125,7 @@ ModuleInternals.prototype._compile = function _compile(
|
|||
];
|
||||
return compiledWrapper.apply(this.exports, args);
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
require(srcPath);
|
||||
|
|
Loading…
Reference in a new issue