-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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: emit event to handle chunk load errors #12084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we missed this one. I'll add it for discussion in the next team meeting so we can include it in Vite 4.4
When is the next team meeting? |
@KaelWD in two days. We'll see to resolve the PR async if we don't manage to get to this PR in the meeting. I'll add it to the 4.4 milestone. |
if (!e.defaultPrevented) { | ||
throw err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to call preventDefault() on the event. Please avoid commenting on old PRs. You can create a Discussion instead for these questions (linking to a PR if you'd like)
Description
resolves #12080
This PR emits a
vite:preloadError
event which can be handled by a framework or user. Primarily this will be useful for saving state and reloading an app in the event of a fresh deployment.Additional context
If
preventDefault()
is called on this event, the error will not be thrown. I confess I'm not entirely sure whether this is a good idea, but it provides an escape hatch that may be useful.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).