Namespaces
The main concept you need to know in order to develop a plugin and a plugin-friendly application
Last updated
Was this helpful?
The main concept you need to know in order to develop a plugin and a plugin-friendly application
Last updated
Was this helpful?
Namespace marks a place that is available for the plugin system, and hence can be modified by plugins. In Mosaic-friendly application, it is advised to have as many namespaces as possible.
This directive accepts a string value, as shown below (as opposed to directives which accept object parts).
Mosaic started in - extensible React storefront. As you can see, each and every class and function throughout the application has a namespace and hence is absolutely plugin-friendly.
Plugins use namespaces to intercept operations with things the namespaces belong to.
For namespace comments to work, Mosaic requires babel-plugin-mosaic-middleware-decorator
plugin. It can be found . This plugin processes the code during the build and transforms the logic as seen below.
If you don't use the Babel plugin mentioned above - the namespace comments will not work properly. Be aware of that - if you are willing to use Typescript, you will need to migrate build process to stack (or ).
All of the instructions in the Getting Started guides handle this for you.
Hence, it is possible to use Mosaic without Babel, but strongly not recommended.