Skip to content

fix: avoid destructure lowering for newer safari#22346

Merged
sapphi-red merged 2 commits into
vitejs:v7from
sapphi-red:fix/avoid-destructure-lowering-for-newer-safari
May 7, 2026
Merged

fix: avoid destructure lowering for newer safari#22346
sapphi-red merged 2 commits into
vitejs:v7from
sapphi-red:fix/avoid-destructure-lowering-for-newer-safari

Conversation

@sapphi-red

Copy link
Copy Markdown
Member

close #22225

If Safari 10 - 14.1 or iOS 10 - 14.5 is specified to build.target, set supported.destructuring: true so 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.

@sapphi-red sapphi-red added the p2-edge-case Bug, but has workaround or limited in scope (priority) label Apr 28, 2026
@netlify

netlify Bot commented Apr 28, 2026

Copy link
Copy Markdown

Deploy Preview for vite-docs-v7 canceled.

Name Link
🔨 Latest commit ef0fb44
🔍 Latest deploy log https://app.netlify.com/projects/vite-docs-v7/deploys/69fc1939e42921000859ed11

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

14.5 part is intentionally excluded but I wasn't sure how to clarify it in the comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

bluwy
bluwy previously approved these changes Apr 29, 2026

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks good to me 👍

@sapphi-red sapphi-red merged commit 5ab51c0 into vitejs:v7 May 7, 2026
16 checks passed
@sapphi-red sapphi-red deleted the fix/avoid-destructure-lowering-for-newer-safari branch May 7, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-edge-case Bug, but has workaround or limited in scope (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants