Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: skip soft invalidation error when timestamp mismatch #15768

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/vite/src/node/server/transformRequest.ts
Expand Up @@ -400,10 +400,13 @@ async function handleModuleSoftInvalidation(
// Skip if not soft-invalidated
if (!transformResult || transformResult === 'HARD_INVALIDATED') return

if (ssr ? mod.ssrTransformResult : mod.transformResult) {
throw new Error(
`Internal server error: Soft-invalidated module "${mod.url}" should not have existing transform result`,
)
// Race condition could happend when invalidation is called before this process is finished
if (timestamp < mod.lastInvalidationTimestamp) {
if (ssr ? mod.ssrTransformResult : mod.transformResult) {
throw new Error(
`Internal server error: Soft-invalidated module "${mod.url}" should not have existing transform result`,
)
}
}

let result: TransformResult
Expand Down