main

  • property
config.main {moduleName | Array<moduleName>}  

The name of the module(s) that loads all other modules in the application.

moduleName

The main module to load after configMain.

Array<moduleName>

An array of main modules that will be loaded after configMain.

Use

This is the starting point of the application. In development, the main module is loaded after the configMain and @dev modules. In production, only the main module is loaded, but it is configured to load in a bundle.

Main should be configured by one of the approaches in config.

Use with npm

In development, your application's package.json will be read and the main module set automatically. For instance, if your package.json looks like:

{
  "main": "my/main.js",
  ...
}

The following will load package.json with the npm module and automatically load my/main.js:

<script src="../node_modules/steal/steal.js">
</script> 

In production, make sure your script specifies main so the correct bundle to load can be known.

Help us improve StealJS by taking our community survey