Benifits of Module Compilation
- In a module, resources such as
API route
,controller
,service
,middleware
,internationalization
andparameter configuration
can be set separately - In
EggJS
, these resources are organized and loaded in the way ofconvention-over-configuration
. While InEggBornJS
, these resources are explicitly organized and loaded byrequire
. Therefore, the modules inEggBornJS
can be compiled separately - 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 - On the other hand,
module compilation
can also meet the needs ofbusiness intellectual property protection
How to compile module
- 1$ cd {project}/src/module/{moduleName}
- 2$ npm run build:front
- 3$ npm run build:backend
Compilation Configuration
src/suite-vendor/test-party/modules/test-party/build/config.js
- 1module.exports = {
- 2 front: {
- 3 productionSourceMap: false,
- 4 uglify: true,
- 5 },
- 6 backend: {
- 7 productionSourceMap: false,
- 8 uglify: true,
- 9 },
- 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$ cd /path/to/project
- 2$ npm run cli :store:publish moduleName
- See also: Cabloy Store Cli
Comments: