fix(minify): preserve 3d transform semantics during minification#1157
Open
zalishchuk wants to merge 2 commits intoparcel-bundler:masterfrom
Open
fix(minify): preserve 3d transform semantics during minification#1157zalishchuk wants to merge 2 commits intoparcel-bundler:masterfrom
zalishchuk wants to merge 2 commits intoparcel-bundler:masterfrom
Conversation
yisibl
reviewed
Feb 23, 2026
| ".foo{transform:translateZ(0)}", | ||
| ); | ||
| minify_test( | ||
| ".foo { transform: translate3d(2px, 3px, 0px)", |
Contributor
There was a problem hiding this comment.
I believe the original test case here is missing a closing curly brace } at the end.
Author
There was a problem hiding this comment.
Absolutely, this pattern has been part of the surrounding transform minify tests and wasn’t introduced by this PR. Honestly, I'm not quite sure why this pattern exists.
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.
Adjust transform minification so we keep 3D transforms as 3D instead of rewriting them into 2D forms.
The motivation is practical: some of these rewrites are mathematically equivalent, but they are not always behavior-equivalent in browsers (especially around compositing/layer promotion in Safari).
Output Changes
translate3d(..., ..., 0)is no longer lowered totranslate(...)/translateY(...).scale3d(..., ..., 1)is no longer lowered toscale(...)/scaleX(...)/scaleY(...).scale3d(1,1,z)now canonicalizes toscaleZ(z)(includingscale3d(1,1,1) -> scaleZ(1)), which keeps transforms in the 3D family.rotateZ(...)staysrotateZ(...)(notrotate(...)).rotate3d(0,0,1,a)now normalizes torotateZ(a)(still 3D).translate3d(0,0,0)now normalizes totranslateZ(0)(same family astranslate3d(0,0,z) -> translateZ(z)).Example
Related Issues