Sharing dependencies
Last updated
Last updated
Some dependencies are shared among all frontend components. We do this for 2 main reasons:
So that the client doesn't have to load the dependencies multiple times
Some library requires that only one copy of itself is used. Eg: Yjs
We achieve this using importmap
, provided by our Remote
and Renderer
wrapper.
This means that for frontend plugin bundles, you should exclude these dependencies from the bundle. Instead, it should import the dependency directly using a bare specifier.
You can look at the build config of any of the plugins in the main repository. They serve as an example of how the build pipeline should be setup.
At the moment of writing, here are the list of shared dependencies:
yjs
react
(react, react-dom, react-dom/client)
To see an up-to-date list, refer to the importmap
definition in the main repo: