Skip to content

Commit

Permalink
fix: Clear correct cache when compiling with Webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordred committed Sep 23, 2021
1 parent 1376eec commit 6ede109
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/server/src/util.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -13,7 +14,7 @@ export const clearModuleCache = moduleName => {
}
})
}
delete require.cache[moduleName]
delete cache[moduleName]
}
}

Expand Down

0 comments on commit 6ede109

Please sign in to comment.