Web compilers for users of
If you are using the autogenerated build script (going through
pub run build_runner <command> instead of handwriting a
then all you need is the
dev_dependency listed above.
By default, the
dartdevc compiler will be used, which is the Dart Development
If you would like to opt into
dart2js you will need to add a
file, which should look roughly like the following:
targets: $default: builders: build_web_compilers|entrypoint: # These are globs for the entrypoints you want to compile. generate_for: - test/**.browser_test.dart - web/**.dart options: compiler: dart2js # List any dart2js specific args here, or omit it. dart2js_args: - --checked
We are working on command line configuration as well, you can follow https://github.com/dart-lang/build/issues/801 for updates on that.
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).
[ apply( 'build_web_compilers|ddc', [ (_) => new ModuleBuilder(), (_) => new UnlinkedSummaryBuilder(), (_) => new LinkedSummaryBuilder(), (_) => new DevCompilerBuilder() ], toAllPackages(), // Recommended, but not required. This makes it so only modules that are // imported by entrypoints get compiled. isOptional: true, hideOutput: true), apply('build_web_compilers|entrypoint', // 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'])), ]
.js.mapfiles from the output directory in release mode.
.tar.gzoutputs produced by
Dart2Jsoutputs other than deferred part files.
dartdevccompiler to detect correct base url for require js.
enable_sync_asyncoption to the
build_web_compilers|entrypointbuilder, which defaults to
dartdevccompiler now respects the
<base href="/....">tags and will set them as the base url for require js.
dart2jsby default in release mode.
.packagesfile and use the new frontend with
dart2jsas a stopgap until we can add support for
dart2jscompiler. If you pass that argument with
.info.jsonfile will be copied the output.
--minify) enabled by default, similar to how it worked in
pub build. If you are adding custom
dart2jsoptions, make sure you still keep the
--minifyflag. Here is an example:
targets: $default: builders: build_web_compilers|entrypoint: generate_for: - web/**.dart options: compiler: dart2js dart2js_args: - --fast-startup - --minify - --trust-type-annotations - --trust-primitives
ignore_cast_failuresoption to the
build_web_compilers|entrypointbuilder which you can set to
trueto enable them.
LinkedSummaryBuilderinto a separate
testare now compiled by default instead of only the
_browser_test.dartfiles (minus vm/node test bootstrap files). This means the original tests can be debugged directly (prior to package:test bootstrapping).
dart2js. This can be configured using the top level
compileroption for the
build_web_compilers|entrypointbuilder. The supported options are
dartdevc(the default) and
dart2js. Args can be passed to
dart2js_argsoption. For example:
targets: <my_package>: builders: build_web_compilers|entrypoint: options: compiler: dart2js dart2js_args: - --minify
entrypoint, the exposed class also changed from
ddcBootstrapExtensionsince it is only required when using the dev compiler.
Add this to your package's pubspec.yaml file:
dependencies: build_web_compilers: ^0.4.0+1
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|2.0.0||Apr 24, 2019|
|1.2.1||Apr 17, 2019|
|1.2.0||Mar 14, 2019|
|1.1.0||Feb 1, 2019|
|1.0.2||Feb 1, 2019|
|1.0.1||Jan 31, 2019|
|1.0.0||Dec 10, 2018|
|0.4.4+3||Dec 5, 2018|
|0.4.4+2||Oct 8, 2018|
|0.4.4+1||Sep 26, 2018|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.
dartdoc successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.
|Dart SDK||>=2.0.0-dev.50 <2.0.0|