Webdev 5.0


The webdev package provides a command line interface (CLI) for users and tools to build and serve web apps. The webdev tool is built on build_runner and replaces pub build and pub serve. If you’ve previously used build_runner, you should no longer need to use it directly, except to run tests from the command line.

Installation

Globally install webdev using pub:

$ pub global activate webdev

Command: serve

To launch a development server, which serves your app and watches for source code changes, use the following command:

webdev serve [--release] [ [<directory>[:<port>]] ... ]

By default your app is compiled using dartdevc and served from the web directory on port 8080:

$ webdev serve

To build using dart2js, add the --release flag.

You can specify different directory-port configurations. For example, the following command sets up an additional port to run component tests in the browser at localhost:8081:

$ webdev serve web test:8081

To run tests directly from the command line use build_runner test.

Command: build

Use the following command to build your app:

webdev build [--no-release] --output [<dirname>:]<dirname>

The first build is the slowest. After that, assets are cached on disk and incremental builds are much faster.

By default, the build command uses the dart2js web compiler to create a production version of your app. Add --no-release to compile with dartdevc. Using the --output option, you can control which top-level project folders are compiled and where output is written.

For example, the following command uses the dartdevc to compile the project’s top-level web folder into the build directory:

$ webdev build --no-release --output web:build

You can customize your build using build config files. For more information, see Build config files.

More information

For a complete list of webdev options, run webdev --help or see the webdev package README.