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

**URL:** <https://discourse.aurelia.io/t/difference-between-au-build-run-and-au-build-run-env-debug/1381>\
**Category:** Help Requests\
**Created:** [June 30, 2018, 9:07pm UTC](https://discourse.aurelia.io/t/difference-between-au-build-run-and-au-build-run-env-debug/1381 "2018-06-30T21:07:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![myusrn](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/myusrn/32/342_2.png) [@myusrn](https://discourse.aurelia.io/u/myusrn)\
**Post date:** [June 30, 2018, 9:07pm UTC](https://discourse.aurelia.io/t/difference-between-au-build-run-and-au-build-run-env-debug/1381/1 "2018-06-30T21:07:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [July 1, 2018, 6:21am UTC](https://discourse.aurelia.io/t/difference-between-au-build-run-and-au-build-run-env-debug/1381/2 "2018-07-01T06:21:09Z")

</div>

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/...`.

```json
"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:

```json
        "prepend": [
          "node_modules/bluebird/js/browser/bluebird.core.js",
          {
            "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"
          },
          "node_modules/requirejs/require.js"
        ],
        "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`

```js
let env = CLIOptions.getEnvironment();

```
