Move unloadModule to RenderHost

Summary: Define unload module on RenderHost. Not sure how to do that the browser and not sure how meaning full it is in a browser context.

Reviewed By: nikoant

Differential Revision: D32827050

fbshipit-source-id: 87025c6f5c2b950880712bff8df1c92a044a222e
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 6c7a139554
commit d0402d7268
5 changed files with 9 additions and 20 deletions

View File

@@ -195,6 +195,13 @@ export function initializeElectron(
!flipperServerConfig.environmentInfo.isProduction,
);
},
unloadModule(path: string) {
const resolvedPath = global.electronRequire.resolve(path);
if (!resolvedPath || !global.electronRequire.cache[resolvedPath]) {
return;
}
delete global.electronRequire.cache[resolvedPath];
},
} as RenderHost;
setupMenuBar();