Skip to main content

Run and test locally

With MoBro running in the background you simply need to execute

dashboard-cli dev

in your CLI. That will spawn a local watcher, which watches your files and tells MoBro about your working directory. It will then pick up the new widget pack, and you should be able to see it in the dashboard builder flagged as development.

Compiling the widget pack

MoBro itself actually compiles your widget pack and not the cli. It uses webpack in the background to compile your widget pack on every change you do in code. This is due to the following reasons:

  • When publishing a widget pack to the marketplace, it simply ships the code and not a pre-compiled bundle.
  • Third party libraries like React etc. are provided by the dashboard via module federation, so they are always compatible with the installed MoBro version.
  • It's not possible to install any other npm package to reduce security risks. Only the npm packages provided via module federation are available.

You can think of it that way: The dashboard is like a shell in a micro-frontend setup, where every widget pack itself is a micro-frontend. The dashboard provides React, the @modbros/dashboard-sdk and other third party libraries like styled-components, lodash and visx via module federation to the widget packs. A full list of all the packages provided can be found in the dependencies of the widget pack skeleton on github. At the runtime the dashboard then loads the necessary compiled widget pack bundles which are necessary.