build_web_compilers
4.8.12, released 6 weeks ago by tools.dart.dev
Build_runner builder that compiles Dart to JavaScript or WebAssembly for web applications
What it does
It wraps dart2js, dartdevc, and dart2wasm compilers, emitting entrypoint scripts and optional loaders. Configuration is done via build.yaml, allowing fine‑grained control over compiler options and output names.
AI-written summary of version 4.8.12, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building a Flutter web or Dart web app that needs incremental dev builds
- Requiring WebAssembly output alongside JavaScript
- Using build_runner for automated build pipelines
Skip it when
- Non‑web projects that don't use build_runner
- Projects that prefer a single pre‑compiled JavaScript bundle without incremental rebuilds
Strengths
- Supports incremental rebuilds with dartdevc
- Provides WebAssembly output and loader logic
- Highly configurable via build.yaml
- Integrates seamlessly with build_runner ecosystem
Weaknesses
- Only works with build_runner
- Configuration can be verbose
- Requires Dart 3.13+ and specific analyzer versions
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 21
Add as dev_dependency, run `dart pub add --dev build_web_compilers`, create a build.yaml with entrypoint builder configuration, and run `dart run build_runner build`
```yaml
# build.yaml
targets:
$default:
builders:
build_web_compilers:entrypoint:
generate_for:
- web/**.dart
options:
compilers:
dart2js:
args:
- O2
dart2wasm:
args:
- O3
```Works with
Packages commonly used together with build_web_compilers: ones it builds on, ones built on it, and its own family.
- analyzerbuild_web_compilers depends on itPerforms static analysis of Dart code for tool integration and embedding.
- archivebuild_web_compilers depends on itEncodes and decodes archive and compression formats such as zip, tar, gzip, and zlib.
- cryptobuild_web_compilers depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- uuidbuild_web_compilers depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- stack_tracebuild_web_compilers depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- globbuild_web_compilers depends on itA file and directory globbing library that supports Bash-style path matching and listing.
- poolbuild_web_compilers depends on itManage a finite pool of resources to control concurrent operations.
- asyncbuild_web_compilers depends on itUtility classes and helpers that extend Dart's async library.