Anatomy of an extension
Get acknowledged with some rules which apply to any extension
Package.json
For NPM package to be considered an extension, it must have a package.json field mosaic.type equal to extension.
It is important for Mosaic module to be recognized in order for namespaces to work properly (get transpiled into logic).
{
"mosaic": {
"type": "extension"
}
...
}File structure
Mosaic has a minimal requirement towards the folder structure of a module.
All of the .plugin.js files (plugin declaration files) should be located under the src/plugin directory. All the subdirectories of this one are scanned for them, but no other places.
It's recommended to split all of your other logic into separate directories of the src directory. All of the functionality outside of src will not be available for shadowing.
├── 📁 node_modules
├── 📄 package.json
└── 📁 src
├── ... # Any own logic of your extension here
└── 📁 plugin # Plugging logic here!
├── 📄 some.plugin.js
└── 📄 other.plugin.tsLast updated
Was this helpful?