Difference between "au build/run" and "au build/run --env debug"

What difference should one expect from use of “au build/run” vs “au build/run --env debug” and does inclusion of “–watch” switch with run command behave differently w/o --env switch setting vs with “–env debug” setting?

Does not specifying the --env switch when executing “au build/run” commands generate the equivalent of running those commands with something like a “–env release” switch setting?

Env is not hard coded enums in cli based app. If you run without --env, the default environment is “dev”.

The meaning of every environment is not hard coded. The environment name is used in 2 ways in cli based app.

  1. runtime properties, like environment.debug check in your main.js.

Your src/environment.js was copied by cli from aurelia_project/environements/...js. By default, cli generates 3 environment config files for your dev.js, prod.js, and stage.js.

You can add more environment config files, then use --env yourNewEnv to use the file.

There are 2 properties: debug and testing in the default config files. You can add more properties to every env config file, then use those properties at runtime, simply import environment from '../path/to/environment';, then use environemnt.yourNewProperty

  1. compile (bundling) time behaviour control, mainly used in aurelia.json,

In aurelia.json, you can control whether to use uglifyjs and whether to generate sourcemap, using a string targeting interested env. You can use your customised env name if you have added some in aurelia_project/environments/....

"options": {
      "minify": "stage & prod",
      "sourcemaps": "dev & stage"

In aurelia.json, you can conditionally control prepend, append, and depdendencies using env.

There are enough example in aurelia.json if you generate a new app:

        "prepend": [
            "path": "node_modules/aurelia-cli/lib/resources/scripts/configure-bluebird-no-long-stacktraces.js",
            "env": "stage & prod"
            "path": "node_modules/aurelia-cli/lib/resources/scripts/configure-bluebird.js",
            "env": "dev"
        "dependencies": [
          // ...
            "name": "aurelia-testing",
            "env": "dev",
            // ...
          // ...

You can also access environment name in your task files, check the usage in aurelia_project/tasks/transpile.js

let env = CLIOptions.getEnvironment();