mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(utils): early return if id is external
This commit is contained in:
parent
042c0ae692
commit
304fb488dc
@ -3,6 +3,10 @@ export function isExternalDependency (id) {
|
||||
}
|
||||
|
||||
export function clearRequireCache (id) {
|
||||
if (isExternalDependency(id)) {
|
||||
return
|
||||
}
|
||||
|
||||
const entry = getRequireCacheItem(id)
|
||||
|
||||
if (!entry) {
|
||||
@ -10,10 +14,6 @@ export function clearRequireCache (id) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isExternalDependency(id)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (entry.parent) {
|
||||
entry.parent.children = entry.parent.children.filter(e => e.id !== id)
|
||||
}
|
||||
@ -26,6 +26,10 @@ export function clearRequireCache (id) {
|
||||
}
|
||||
|
||||
export function scanRequireTree (id, files = new Set()) {
|
||||
if (isExternalDependency(id) || files.has(id)) {
|
||||
return files
|
||||
}
|
||||
|
||||
const entry = getRequireCacheItem(id)
|
||||
|
||||
if (!entry) {
|
||||
@ -33,10 +37,6 @@ export function scanRequireTree (id, files = new Set()) {
|
||||
return files
|
||||
}
|
||||
|
||||
if (isExternalDependency(id) || files.has(id)) {
|
||||
return files
|
||||
}
|
||||
|
||||
files.add(entry.id)
|
||||
|
||||
for (const child of entry.children) {
|
||||
|
Loading…
Reference in New Issue
Block a user