Thin Module
A Thin Module is a module that only has metadata, no payloads.
As Thin Module does not have any payloads, itsmeta.js
can only accept functioninstall
and optionon
. Any other option likeuse
,set
orsingleton
will not be applicable. The functioninstall
will be used to initialize the module inself and register it to the container.
Thin Module is useful in case of you want to have a light-weight module with small amount of code, or you want to use the module to install somenode_modules
as mentioned in Customizing Module Installation.
Example below represents a thinconfig.development
module:
// meta.js
module.exports = {
install: ($, name, path) => {
$.bind(name).to(Object.freeze({
DB_HOST: 'localhost',
DB_NAME: 'mydb'
// and more...
}));
}
}
Last updated