fix: avoid destructure lowering for newer safari#22346
Merged
sapphi-red merged 2 commits intoMay 7, 2026
Merged
Conversation
✅ Deploy Preview for vite-docs-v7 canceled.
|
| const destructuringBugRE = /^(safari|ios)(\d+)(?:\.(\d+))?$/ | ||
|
|
||
| // Workaround for https://github.com/evanw/esbuild/issues/4436 | ||
| // Safari 10 through 14.1 and ios 10 through 14.5 have a bug related to destructuring. |
Contributor
There was a problem hiding this comment.
The comment incorrectly states the version ranges affected by the bug. Based on the test cases and implementation logic, it should be:
// Safari 10 through 14.0 and iOS 10 through 14.4 have a bug related to destructuring.The current comment says "through 14.1" and "through 14.5" which incorrectly implies those versions are affected, but the code and tests explicitly exclude them from the workaround.
Suggested change
| // Safari 10 through 14.1 and ios 10 through 14.5 have a bug related to destructuring. | |
| // Safari 10 through 14.0 and iOS 10 through 14.4 have a bug related to destructuring. | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
Member
Author
There was a problem hiding this comment.
14.5 part is intentionally excluded but I wasn't sure how to clarify it in the comment
Member
There was a problem hiding this comment.
I think what Graphite suggested make sense, since through here means implicitly inclusive. Could add a (exclusive) here but I think that would be confusing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #22225
If Safari 10 - 14.1 or iOS 10 - 14.5 is specified to
build.target, setsupported.destructuring: trueso that we restore the behavior of esbuild before v0.27.7.This means if the user wants to avoid the safari bug described in evanw/esbuild#4436, they would need to use Vite v8 + plugin-legacy.