build_web_compilers 0.3.1

  • Installing
  • Versions
  • 90


Web compilers for users of package:build.
Build Status Issues related to build_web_compilers Pub Package Version Latest Dartdocs Join the chat on Gitter


This package is intended to be used as a development dependency for users of package:build who want to run code in a browser. Simply add the following to your pubspec.yaml:



If you are using the autogenerated build script (going through pub run build_runner <command> instead of handwriting a build.dart file), then all you need is the dev_dependency listed above.


By default, the dartdevc compiler will be used, which is the Dart Development Compiler.

If you would like to opt into dart2js you will need to add a build.yaml file, which should look roughly like the following:

        # These are globs for the entrypoints you want to compile.
        - test/**.browser_test.dart
        - web/**.dart
          compiler: dart2js
          # List any dart2js specific args here, or omit it.
          - --checked

We are working on command line configuration as well, you can follow for updates on that.

Manual Usage

If you are using a custom build script, you will need to add the following builder applications to what you already have, almost certainly at the end of the list (unless you need to post-process the js files).

        (_) => new ModuleBuilder(),
        (_) => new UnlinkedSummaryBuilder(),
        (_) => new LinkedSummaryBuilder(),
        (_) => new DevCompilerBuilder()
        // Recommended, but not required. This makes it so only modules that are
        // imported by entrypoints get compiled.
        isOptional: true,
        hideOutput: true),
        // You can also use `WebCompiler.Dart2Js`. If you don't care about
        // dartdevc at all you may also omit the previous builder application
        // entirely.
        [(_) => new WebEntrypointBuilder(WebCompiler.DartDevc)], toRoot(),
        hideOutput: true,
        // These globs should match your entrypoints only.
        defaultGenerateFor: const InputSet(
            include: const ['web/**', 'test/**.browser_test.dart'])),


  • Cast failures will now be ignored in dartdevc by default (these were enabled in the latest sdk), and added an ignore_cast_failures option to the build_web_compilers|entrypoint builder which you can set to true to enable them.
    • At some point in the future it is expected that the default for this will flip.


  • Fixed an issue with dart2js and the --no-source-maps flag.


Breaking changes

  • Split ModuleBuilder, UnlinkedSummaryBuilder and LinkedSummaryBuilder into a separate build_modules package.


  • Support the latest analyzer package.


  • All dart files under test are now compiled by default instead of only the _browser_test.dart files (minus vm/node test bootstrap files). This means the original tests can be debugged directly (prior to package:test bootstrapping).
  • Updated to package:build version 0.12.0.


New Features

  • Added support for dart2js. This can be configured using the top level compiler option for the build_web_compilers|entrypoint builder. The supported options are dartdevc (the default) and dart2js. Args can be passed to dart2js using the dart2js_args option. For example:
          compiler: dart2js
          - --minify

Breaking Changes

  • Renamed ddc_bootstrap builder to entrypoint, the exposed class also changed from DevCompilerBootstrapBuilder to WebEntrypointBuilder.
  • Renamed jsBootstrapExtension to ddcBootstrapExtension since it is only required when using the dev compiler.


  • Mark ddc_bootstrap builder with build_to: cache.
  • Publish as build_web_compilers


  • Add builder factories.
  • Fixed temp dir cleanup bug on windows.
  • Enabled support for running tests in --precompiled mode.


  • Initial release with support for building analyzer summaries and DDC modules.

1. Depend on it

Add this to your package's pubspec.yaml file:

  build_web_compilers: "^0.3.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:build_web_compilers/build_web_compilers.dart';
Version Uploaded Documentation Archive
0.3.1 Feb 22, 2018 Go to the documentation of build_web_compilers 0.3.1 Download build_web_compilers 0.3.1 archive
0.3.0 Feb 7, 2018 Go to the documentation of build_web_compilers 0.3.0 Download build_web_compilers 0.3.0 archive
0.2.1+1 Feb 5, 2018 Go to the documentation of build_web_compilers 0.2.1+1 Download build_web_compilers 0.2.1+1 archive
0.2.1 Jan 18, 2018 Go to the documentation of build_web_compilers 0.2.1 Download build_web_compilers 0.2.1 archive
0.2.0 Jan 9, 2018 Go to the documentation of build_web_compilers 0.2.0 Download build_web_compilers 0.2.0 archive
0.1.1 Dec 22, 2017 Go to the documentation of build_web_compilers 0.1.1 Download build_web_compilers 0.1.1 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 22, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
80 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: Flutter, other

Primary library: package:build_web_compilers/build_web_compilers.dart with components: io, build.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use build_web_compilers.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.1 <2.0.0
analyzer >=0.30.0 <0.32.0 0.31.1 0.31.2-alpha.0
bazel_worker ^0.1.4 0.1.9
build ^0.12.0 0.12.0+1
build_config ^0.2.1 0.2.3
build_modules ^0.1.0 0.1.0+2
cli_util ^0.1.2 0.1.2+1
logging ^0.11.2 0.11.3+1
path ^1.4.2 1.5.1
scratch_space ^0.0.1 0.0.1+3
Transitive dependencies
args 1.4.0
async 2.0.3 2.0.4
charcode 1.1.1
collection 1.14.5
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
fixnum 0.10.7
front_end 0.1.0-alpha.9 0.1.0-alpha.10
glob 1.1.5
html 0.13.2+2
isolate 1.1.0
json_annotation 0.2.2
kernel 0.3.0-alpha.9 0.3.0-alpha.10
meta 1.1.2
package_config 1.0.3
plugin 0.2.0+2
pool 1.3.4
protobuf 0.7.1
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
yaml 2.1.13
Dev dependencies
build_runner ^0.7.0
build_test ^0.10.0
test ^0.12.24