diff --git a/packages/server/src/util.js b/packages/server/src/util.js index e181351c8..43ba3424a 100644 --- a/packages/server/src/util.js +++ b/packages/server/src/util.js @@ -1,5 +1,6 @@ export const clearModuleCache = moduleName => { - const m = require.cache[moduleName] + const cache = (typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : require).cache; + const m = cache[moduleName] if (m) { // remove self from own parents if (m.parent && m.parent.children) { @@ -13,7 +14,7 @@ export const clearModuleCache = moduleName => { } }) } - delete require.cache[moduleName] + delete cache[moduleName] } }