Skip to content

fix(minifier): remove incorrect not + conditional expression compression#8759

Merged
Boshen merged 1 commit intomainfrom
01-28-fix_minifier_remove_incorrect_not_conditional_expression_compression
Jan 28, 2025
Merged

fix(minifier): remove incorrect not + conditional expression compression#8759
Boshen merged 1 commit intomainfrom
01-28-fix_minifier_remove_incorrect_not_conditional_expression_compression

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Jan 28, 2025

var foo = (a) => {
  if (!(a == null ? void 0 : a.b))
    return
  a.b(to);
};
foo(null)

was minified into

var foo = (a) => {
	if (a == null && a.b) return;
	a.b(to);
};
foo(null);

which is incorrect (no error happens before and error happens after).
I found this while trying rolldown-vite with ecosystem-ci.

refs #8651

@github-actions github-actions bot added the A-minifier Area - Minifier label Jan 28, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-bug Category - Bug label Jan 28, 2025
@sapphi-red sapphi-red marked this pull request as ready for review January 28, 2025 05:00
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 28, 2025

CodSpeed Performance Report

Merging #8759 will not alter performance

Comparing 01-28-fix_minifier_remove_incorrect_not_conditional_expression_compression (d4f9e13) with main (ef55e7c)

Summary

✅ 33 untouched benchmarks

@Boshen Boshen self-requested a review January 28, 2025 05:17
@Boshen
Copy link
Member

Boshen commented Jan 28, 2025

Let me investigate esbuild's implementation.

@Boshen Boshen merged commit 66c33ed into main Jan 28, 2025
30 checks passed
@Boshen Boshen deleted the 01-28-fix_minifier_remove_incorrect_not_conditional_expression_compression branch January 28, 2025 05:30
@oxc-bot oxc-bot mentioned this pull request Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants