What is Scene?

The frontend of a project can run in different host environments, such as Web browser, Electron, IOS, Android, WeChat, Enterprise WeChat and Dingtalk, etc.

We can define multiple scenes, and one scene is used for one or more host environments. In this way, we can provide different configurations for different scenes and output different frontend files during building

Scene Config

CabloyJS has several built-in config files of scenes:

  1. 1src/front/config
  2. 2|- config.default.js
  3. 3|- config.web.js
  4. 4|- config.app.js
Name Description
config.default.js Contains the default configuration common to all scenes
config.web.js It is the config file of the scene of web, and the web is the default scene
config.app.js If we want to create a scene of app, just add the file config.app.js

Scene Build

1. Build web scene

When the npm script does not take the scene parameter, the web scene is built by default

  1. 1$ npm run build:front

2. Build app scene

  1. 1$ npm run build:front -- --scene=app