Skip to content

Commit

Permalink
refactor: batch updated module info
Browse files Browse the repository at this point in the history
  • Loading branch information
sun0day committed Mar 28, 2023
1 parent 7007ad2 commit 4946b09
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/vite/src/node/server/moduleGraph.ts
Expand Up @@ -150,7 +150,7 @@ export class ModuleGraph {
const prevImports = mod.importedModules
const nextImports = (mod.importedModules = new Set())
let noLongerImported: Set<ModuleNode> | undefined
let resolvePromises = []
const resolvePromises = []
// update import graph
for (const imported of importedModules) {
if (typeof imported === 'string') {
Expand All @@ -166,8 +166,6 @@ export class ModuleGraph {
}
}

resolvePromises.length && (await Promise.all(resolvePromises))

// remove the importer from deps that were imported but no longer are.
prevImports.forEach((dep) => {
if (!nextImports.has(dep)) {
Expand All @@ -181,7 +179,6 @@ export class ModuleGraph {

// update accepted hmr deps
const deps = (mod.acceptedHmrDeps = new Set())
resolvePromises = []
for (const accepted of acceptedModules) {
if (typeof accepted === 'string') {
resolvePromises.push(
Expand Down

0 comments on commit 4946b09

Please sign in to comment.