From f1b0f243155ed0aec8a33b0a031064bbd5d682ad Mon Sep 17 00:00:00 2001 From: Florent Benoit Date: Fri, 15 Mar 2019 15:57:04 +0100 Subject: [PATCH] Do not remove only the entrypoint from the cache but also all the files of the plug-in. Else some of the files may still have previous values while some others were correctly invalidated Change-Id: I09f745145b05c041e8f0cd55e85a666617527d76 Signed-off-by: Florent Benoit --- packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts index 4bd711f197276..e6ccc3a546446 100644 --- a/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts +++ b/packages/plugin-ext/src/hosted/node/plugin-host-rpc.ts @@ -88,7 +88,13 @@ export class PluginHostRPC { loadPlugin(plugin: Plugin): void { console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')'); try { - delete require.cache[require.resolve(plugin.pluginPath)]; + // cleaning the cache for all files of that plug-in. + Object.keys(require.cache).forEach(key => { + if (key.startsWith(plugin.pluginFolder)) { + // delete entry + delete require.cache[key]; + } + }); return require(plugin.pluginPath); } catch (e) { console.error(e);