Skip to content
pubscout

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

$ flutter pub add build_web_compilers
Source repository

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.