デッドコード除去とは何か
デッドコード除去 (DCE) は、結果に到達可能な影響を持たないコードを検出し、出力から削除する最適化です。到達不能な分岐、未使用の変数、値が決して読まれない計算を取り除きます。このコードを削ることで、最適化器はバイナリや bundle のサイズを縮小し、実行時のパフォーマンスを向上させることもあります。
なぜ重要か
決して実行されないコードを配信することは、ダウンロード、解析、実行のリソースを無駄にします。DCE は artifact を自動的に軽量に保ち、これは多数のユーザーに配信されるフロントエンドの bundle で最も重要になります。
関連ガイド
Tree Shaking - CI/CD Glossary DefinitionTree shaking removes code that is never imported or used from a bundle by analyzing the module graph, shrinki…
What Is Scope Hoisting?Scope hoisting is a bundler optimization that concatenates modules into a single scope instead of wrapping ea…
What Is a Bundle Size Budget?A bundle size budget caps the byte size of compiled JavaScript or CSS bundles, failing the build when a chang…