From 2b3e486ab913ff77707410b9cee3ba6d256ccc95 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:59:54 +0530 Subject: [PATCH] fix: multiple cache busting imports causing useData to fail closes #3820 reverts #3398 reopens #3363 --- src/client/app/index.ts | 2 -- src/node/build/build.ts | 4 +--- src/node/build/render.ts | 6 +----- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/client/app/index.ts b/src/client/app/index.ts index 72cc5063802f..2c7c66f0487d 100644 --- a/src/client/app/index.ts +++ b/src/client/app/index.ts @@ -150,8 +150,6 @@ function newRouter(): Router { url.hash return import(/*@vite-ignore*/ path) }) - } else if (import.meta.env.SSR) { - pageModule = import(/*@vite-ignore*/ `${pageFilePath}?t=${Date.now()}`) } else { pageModule = import(/*@vite-ignore*/ pageFilePath) } diff --git a/src/node/build/build.ts b/src/node/build/build.ts index d6177864ebc0..08289b86dc93 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -52,9 +52,7 @@ export async function build( } const entryPath = path.join(siteConfig.tempDir, 'app.js') - const { render } = await import( - pathToFileURL(entryPath).toString() + '?t=' + Date.now() - ) + const { render } = await import(pathToFileURL(entryPath).href) await task('rendering pages', async () => { const appChunk = diff --git a/src/node/build/render.ts b/src/node/build/render.ts index c9b71c819484..844498e5494b 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -52,11 +52,7 @@ export async function renderPage( try { // resolve page data so we can render head tags const { __pageData } = await import( - pathToFileURL( - path.join(config.tempDir, pageServerJsFileName) - ).toString() + - '?t=' + - Date.now() + pathToFileURL(path.join(config.tempDir, pageServerJsFileName)).href ) pageData = __pageData } catch (e) {