mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(module): protect clearRequireCache
against infinite recursion (#7966)
This commit is contained in:
parent
447340e91c
commit
7cecbccabd
@ -20,11 +20,12 @@ export function clearRequireCache (id) {
|
|||||||
entry.parent.children = entry.parent.children.filter(e => e.id !== id)
|
entry.parent.children = entry.parent.children.filter(e => e.id !== id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Needs to be cleared before children, to protect against circular deps (#7966)
|
||||||
|
delete require.cache[id]
|
||||||
|
|
||||||
for (const child of entry.children) {
|
for (const child of entry.children) {
|
||||||
clearRequireCache(child.id)
|
clearRequireCache(child.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete require.cache[id]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function scanRequireTree (id, files = new Set()) {
|
export function scanRequireTree (id, files = new Set()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user