fix: invalidate module cache for subsequent builds (#3398)

pull/3388/merge
Divyansh Singh 11 months ago committed by GitHub
parent 09e48db355
commit 27f60e0b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -135,8 +135,12 @@ function newRouter(): Router {
pageFilePath = pageFilePath.replace(/\.js$/, '.lean.js') pageFilePath = pageFilePath.replace(/\.js$/, '.lean.js')
} }
if (import.meta.env.SSR) {
pageModule = import(/*@vite-ignore*/ pageFilePath + '?t=' + Date.now())
} else {
pageModule = import(/*@vite-ignore*/ pageFilePath) pageModule = import(/*@vite-ignore*/ pageFilePath)
} }
}
if (inBrowser) { if (inBrowser) {
isInitialPageLoad = false isInitialPageLoad = false

@ -52,7 +52,9 @@ export async function build(
} }
const entryPath = path.join(siteConfig.tempDir, 'app.js') const entryPath = path.join(siteConfig.tempDir, 'app.js')
const { render } = await import(pathToFileURL(entryPath).toString()) const { render } = await import(
pathToFileURL(entryPath).toString() + '?t=' + Date.now()
)
await task('rendering pages', async () => { await task('rendering pages', async () => {
const appChunk = const appChunk =

@ -52,7 +52,11 @@ export async function renderPage(
try { try {
// resolve page data so we can render head tags // resolve page data so we can render head tags
const { __pageData } = await import( const { __pageData } = await import(
pathToFileURL(path.join(config.tempDir, pageServerJsFileName)).toString() pathToFileURL(
path.join(config.tempDir, pageServerJsFileName)
).toString() +
'?t=' +
Date.now()
) )
pageData = __pageData pageData = __pageData
} catch (e) { } catch (e) {

Loading…
Cancel
Save