env

  • property
config.env {String}  

Specifies which environment the application is loading within.

String

Any string value is possible.

Use

Previously setting env was used to control when bundles were loaded, by setting env to production. This functionality has been superceded by loadBundles.

env can be any string value and separated by a dash -. This is useful to, for example, set the environment as being both production and server if doing server-side rendering.

<script src="./node_modules/steal/steal.js" env="window-production" main="myapp"></script>
steal.loader.isEnv("production"); // true
steal.loader.isPlatform("window"); // true

Rarely do you need to set env any more, more likely you want to use loadBundles. env is set by plugins in most cases.

Common values

A few of the common env values include:

  • window-development: This is value when using Steal in dev mode in the browser.
  • window-production: This is the value set for production builds, built using steal-tools.
  • server-development / server-production: These are values set by done-ssr when loading a Steal application for server-side rendering purposes.
  • electron-production: Set when using the steal-electron plugin.
  • cordova-production: Set when using the steal-cordova plugin.
Help us improve StealJS by taking our community survey