diff --git a/packages/vite/package.json b/packages/vite/package.json index e619c78c28..ccd4b2c33c 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -49,7 +49,7 @@ "ufo": "^0.8.5", "unplugin": "^0.9.2", "vite": "~3.0.8", - "vite-node": "^0.22.0", + "vite-node": "^0.22.1", "vite-plugin-checker": "^0.4.9", "vue-bundle-renderer": "^0.4.2" }, diff --git a/packages/vite/src/runtime/vite-node.mjs b/packages/vite/src/runtime/vite-node.mjs index a4c5d93350..3a12d90edc 100644 --- a/packages/vite/src/runtime/vite-node.mjs +++ b/packages/vite/src/runtime/vite-node.mjs @@ -27,12 +27,7 @@ export default async (ssrContext) => { const invalidates = await $fetch('/invalidates', { baseURL: viteNodeOptions.baseURL }) - const updates = new Set() - for (const key of invalidates) { - if (runner.moduleCache.delete(key)) { - updates.add(key) - } - } + const updates = runner.moduleCache.invalidateDepTree(invalidates) // Execute SSR bundle on demand const start = performance.now() diff --git a/packages/vite/src/vite-node.ts b/packages/vite/src/vite-node.ts index 55bfd7c2af..743b3a674e 100644 --- a/packages/vite/src/vite-node.ts +++ b/packages/vite/src/vite-node.ts @@ -78,14 +78,6 @@ function createViteNodeMiddleware (ctx: ViteBuildContext, invalidates: Set { - // When a file has been invalidated, we also invalidate the entry module - if (invalidates.size) { - for (const key of ctx.ssrServer!.moduleGraph.fileToModulesMap.keys()) { - if (key.startsWith(ctx.nuxt.options.appDir + '/entry')) { - invalidates.add(key) - } - } - } const ids = Array.from(invalidates) invalidates.clear() return ids diff --git a/yarn.lock b/yarn.lock index 46540bf9d5..f3861b6c37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1815,7 +1815,7 @@ __metadata: unbuild: latest unplugin: ^0.9.2 vite: ~3.0.8 - vite-node: ^0.22.0 + vite-node: ^0.22.1 vite-plugin-checker: ^0.4.9 vue: 3.2.37 vue-bundle-renderer: ^0.4.2 @@ -13488,9 +13488,9 @@ __metadata: languageName: node linkType: hard -"vite-node@npm:^0.22.0": - version: 0.22.0 - resolution: "vite-node@npm:0.22.0" +"vite-node@npm:^0.22.1": + version: 0.22.1 + resolution: "vite-node@npm:0.22.1" dependencies: debug: ^4.3.4 mlly: ^0.5.12 @@ -13498,7 +13498,7 @@ __metadata: vite: ^2.9.12 || ^3.0.0-0 bin: vite-node: vite-node.mjs - checksum: 2b5552b2ae1e20bf139e6b88e2b59910f4cedd01a9355b6bfbf3d10d36cb5979660a83e47e9db4c1523b874441c7a1498074bef6dc47c14cc3ace857eceaec13 + checksum: 29a4edb4e3f1344a4334dd46ce8e023862831c74a8aca0266c625fbfbdc5a31e83bb64992b08a82249c8a298d5bbbf84bc27ff6af5fe60514e307008443a2d2a languageName: node linkType: hard