diff --git a/packages/utils/src/cjs.js b/packages/utils/src/cjs.js index 8e2fc97f95..84f9f384f2 100644 --- a/packages/utils/src/cjs.js +++ b/packages/utils/src/cjs.js @@ -1,11 +1,15 @@ import { join } from 'path' +export function isHMRCompatible (id) { + return !/[/\\]mongoose[/\\/]/.test(id) +} + export function isExternalDependency (id) { return /[/\\]node_modules[/\\]/.test(id) } export function clearRequireCache (id) { - if (isExternalDependency(id)) { + if (isExternalDependency(id) && isHMRCompatible(id)) { return }