Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,18 @@ export class PluginLoader {
*/
loadPlugins(pluginList: PluginNames) {
if (this.hookState === HookState.UNINITIALIZED) {
hook(Object.keys(pluginList), (exports, name, basedir) => {
const modulesToHook = Object.keys(pluginList);

// Do not hook require when no module is provided. In this case it is
// not necessary. With skipping this step we lower our footprint in
// customer applications and require-in-the-middle won't show up in CPU
// frames.
if (modulesToHook.length === 0) {
this.hookState = HookState.DISABLED;
return;
}

hook(modulesToHook, (exports, name, basedir) => {
if (this.hookState !== HookState.ENABLED) {
return exports;
}
Expand Down