Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[devtools_extensions] build_and_copy ships ~14 MB of assets the extension never loads (CanvasKit variants + un-tree-shaken icon font)

オープン
#9,897 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
dart

調査の方向性

dart run devtools_extensions build_and_copy の実装から始め、Flutter web build をどのように呼び出して extension/devtools/build/ をコピーしているかを調べます。生成された flutter_bootstrap.js の参照と、コピーされた canvaskit/ の内容を、アイコンの tree-shaking フラグも含めて比較します。CDN ビルドでは未使用のアセットが除外され、オフラインビルドでは必要なファイルが保持され、さらにアイコンの tree-shaking を選択しても有効な拡張機能が壊れない状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

cost: medium devtools extensions P2

Summary

dart run devtools_extensions build_and_copy produces extension builds that are CDN-configured (the default for flutter build web), yet copies the entire local canvaskit/ directory — every engine variant plus debug symbols — into extension/devtools/build/, and hardcodes --no-tree-shake-icons. The result is ~14 MB of published assets per package that the extension never fetches at runtime.

Since the extension build is published inside each package's pub archive, every package that ships a DevTools extension carries this weight, and every consumer downloads it on pub get.

Evidence

My package (kaisel): archive was 15 MB. After pruning build/canvaskit/ and rebuilding with icon tree-shaking, it is 1 MB, with no runtime behavior
change:

  • flutter_bootstrap.js in the build references gstatic.com/flutter-canvaskit, so the local canvaskit/ files (canvaskit.wasm 6.9 MB, chromium/ 5.5 MB, skwasm_heavy 4.9 MB, experimental_webparagraph/ 3.9 MB, skwasm 3.4 MB, plus ~7 MB of .js.symbols) are never requested.
  • The build is compileTarget: dart2js, so the skwasm* variants are unreachable regardless of CDN configuration.
  • Rebuilding without --no-tree-shake-icons succeeds — the compiler's own verification passed (it fails the build on non-const IconData) — and MaterialIcons went from 1,645,184 bytes to 9,040 bytes (99.5%).

Proposal

  1. Prune build/canvaskit/ in the copy step when the build is CDN-configured (the default). At minimum, always prune the skwasm* / experimental variants for dart2js builds, where they are unreachable. If an author builds with --no-web-resources-cdn (e.g. for offline use — related: #4721), keep canvaskit.wasm + chromium/canvaskit.wasm and drop only the unreachable variants and .js.symbols.
  2. Expose a --tree-shake-icons passthrough (keeping today's --no-tree-shake-icons as the default if desired). Tree-shaking is verified at compile time — it fails loudly when an extension constructs IconData dynamically — so extensions that pass the check could opt into the ~1.6 MB saving safely.

Environment: devtools_extensions 0.5.1, Flutter 3.44.2 (Dart 3.12.2), macOS.

主要言語
Dart
スター
1.7k
フォーク
405
平均マージ
3日 17時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

flutter/devtools のほかの issue

flutter/devtools の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。