Benifits of Module Compilation

  1. In a module, resources such as API route, controller, service, middleware, internationalization and parameter configuration can be set separately
  2. In EggJS, these resources are organized and loaded in the way of convention-over-configuration. While In EggBornJS, these resources are explicitly organized and loaded by require. Therefore, the modules in EggBornJS can be compiled separately
  3. Modules can be compiled separately, so that they can be published, deployed and upgraded separately, so as to promote the prosperity of the whole ecosystem of CabloyJS, and further accelerate the development of actural business
  4. On the other hand, module compilation can also meet the needs of business intellectual property protection

How to compile module

  1. 1$ cd {project}/src/module/{moduleName}
  2. 2$ npm run build:front
  3. 3$ npm run build:backend

Compilation Configuration

src/suite-vendor/test-party/modules/test-party/build/config.js

  1. 1module.exports = {
  2. 2 front: {
  3. 3 productionSourceMap: false,
  4. 4 uglify: true,
  5. 5 },
  6. 6 backend: {
  7. 7 productionSourceMap: false,
  8. 8 uglify: true,
  9. 9 },
  10. 10};
Name Description
productionSourceMap Generate SourceMap file or not
uglify uglify codes or not

How to publish module

When the module in the project is stable, you can publish and contribute the module to the Open Source Community. You can also publish the module to Cabloy Store

  1. 1$ cd /path/to/project
  2. 2$ npm run cli :store:publish moduleName