Skip to content

Conversation

@biggs0125
Copy link
Contributor

Provides extra minification controls for web builds. Updates the existing --minify flag to pass its value to both JS and wasm (instead of just JS).

Also adds two new flags --minify-js and --minify-wasm which toggle minification for just one of the web targets. While JS minification has a huge impact on code size, wasm minification has a much smaller effect on the program's size. Since minification can obfuscate useful info (like errors) one may want to turn off minification for wasm but leave it on for JS.

The plan is to temporarily use --no-minify-wasm for devtools to help debug some exceptions being seen.

@biggs0125 biggs0125 requested a review from kenzieschmoll June 26, 2025 05:24
@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 26, 2025
@biggs0125 biggs0125 requested a review from mdebbar June 26, 2025 22:47
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

Should we consider removing the --minify flag in favor of the new ones? Thoughts, @kevmoo?

I think what I'm suggesting here is to rename Kevin's --minify flag to --minify-js (which is what it was actually doing), and introduce a new --minify-wasm.

@biggs0125
Copy link
Contributor Author

Should we consider removing the --minify flag in favor of the new ones?

My main concern was removing the flag if people are using it in a config somewhere. Perhaps we could start the process to remove the flag in a follow-up?

@mdebbar
Copy link
Contributor

mdebbar commented Jun 27, 2025

My main concern was removing the flag if people are using it in a config somewhere. Perhaps we could start the process to remove the flag in a follow-up?

The flag is recent and I wouldn't expect many people are using it. It also hasn't made it to a stable release yet.

@kevmoo
Copy link
Contributor

kevmoo commented Jun 27, 2025

We should look to see when I put in --minify It might have just been this release in which case it's not breaking to change things for the next ~6 days.

@biggs0125
Copy link
Contributor Author

Oh nice, I didn't realize it was new. I've gone ahead and removed it then. Thanks!

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

Thank you! Looks good to me.

const WasmCompilerConfig({
super.optimizationLevel,
this.stripWasm = true,
this.minify = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we set this to false or null for flutter run here:

return WasmCompilerConfig(
optimizationLevel: 0,
stripWasm: false,
renderer: debuggingOptions.webRenderer,
);

?

@kevmoo
Copy link
Contributor

kevmoo commented Jun 27, 2025

WAIT! Please double check when i added that flag! It's been a minute! Okay?

@mdebbar
Copy link
Contributor

mdebbar commented Jun 27, 2025

WAIT! Please double check when i added that flag! It's been a minute! Okay?

@kevmoo I checked. It's only in beta AFAICT: cb3150f

@kevmoo
Copy link
Contributor

kevmoo commented Jun 27, 2025

WONDERFUL! Just wanted to be sure. Thanks, @mdebbar !

Copy link
Member

@kenzieschmoll kenzieschmoll left a comment

Choose a reason for hiding this comment

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

a couple comments but lgtm

@biggs0125
Copy link
Contributor Author

Thanks everyone!

@biggs0125 biggs0125 added this pull request to the merge queue Jun 28, 2025
Merged via the queue into flutter:master with commit 85486ff Jun 28, 2025
138 checks passed
@biggs0125 biggs0125 deleted the add-wasm-minify branch June 28, 2025 18:14
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 29, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
Provides extra minification controls for web builds. Updates the
existing `--minify` flag to pass its value to both JS and wasm (instead
of just JS).

Also adds two new flags `--minify-js` and `--minify-wasm` which toggle
minification for just one of the web targets. While JS minification has
a huge impact on code size, wasm minification has a much smaller effect
on the program's size. Since minification can obfuscate useful info
(like errors) one may want to turn off minification for wasm but leave
it on for JS.

The plan is to temporarily use `--no-minify-wasm` for devtools to help
debug some exceptions being seen.

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Provides extra minification controls for web builds. Updates the
existing `--minify` flag to pass its value to both JS and wasm (instead
of just JS).

Also adds two new flags `--minify-js` and `--minify-wasm` which toggle
minification for just one of the web targets. While JS minification has
a huge impact on code size, wasm minification has a much smaller effect
on the program's size. Since minification can obfuscate useful info
(like errors) one may want to turn off minification for wasm but leave
it on for JS.

The plan is to temporarily use `--no-minify-wasm` for devtools to help
debug some exceptions being seen.

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants