diff options
author | 2021-12-02 10:48:08 -0500 | |
---|---|---|
committer | 2021-12-02 10:48:08 -0500 | |
commit | 2a2eaadc2f5ca0ac88eb3fd987881a47b41e9bdd (patch) | |
tree | 83c75e40466fe798b57773f9db570f4b8609d37c | |
parent | 0b2650d71329f4fcdc6f025ec39d70b352990b03 (diff) | |
download | astro-2a2eaadc2f5ca0ac88eb3fd987881a47b41e9bdd.tar.gz astro-2a2eaadc2f5ca0ac88eb3fd987881a47b41e9bdd.tar.zst astro-2a2eaadc2f5ca0ac88eb3fd987881a47b41e9bdd.zip |
Invalidate based on modulePath (#2086)
* Invalidate based on modulePath
* Adds a changeset
-rw-r--r-- | .changeset/dull-parents-speak.md | 5 | ||||
-rw-r--r-- | packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/.changeset/dull-parents-speak.md b/.changeset/dull-parents-speak.md new file mode 100644 index 000000000..90a63e0ad --- /dev/null +++ b/.changeset/dull-parents-speak.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes invalidation of proxy module (inline script modules) diff --git a/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js b/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js index 0a7a5a722..ea92bf449 100644 --- a/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js +++ b/packages/astro/vendor/vite/dist/node/chunks/dep-35df7f96.js @@ -56984,7 +56984,10 @@ const devHtmlHook = async (html, { path: htmlPath, server, originalUrl }) => { addToHTMLProxyCache(config, url, scriptModuleIndex, contents); const modulePath = `${config.base + htmlPath.slice(1)}?html-proxy&index=${scriptModuleIndex}.js`; // invalidate the module so the newly cached contents will be served - server === null || server === void 0 ? void 0 : server.moduleGraph.invalidateId(config.root + modulePath); + const module = server === null || server === void 0 ? void 0 : server.moduleGraph.getModuleById(modulePath); + if (module) { + server === null || server === void 0 ? void 0 : server.moduleGraph.invalidateModule(module); + } s.overwrite(node.loc.start.offset, node.loc.end.offset, `<script type="module" src="${modulePath}"></script>`); } } @@ -57115,12 +57118,6 @@ class ModuleGraph { mod.ssrTransformResult = null; invalidateSSRModule(mod, seen); } - invalidateId(id) { - const mod = this.idToModuleMap.get(id); - if (mod) { - this.invalidateModule(mod); - } - } invalidateAll() { const seen = new Set(); this.idToModuleMap.forEach((mod) => { |