Demos for doing dependency management with Piral.
⚡ Bundle or share dependencies with Piral.
Feel free to play around with the code using StackBlitz.
You can visit this demo at dependency-management.samples.piral.cloud/.
Install the dependencies:
yarn install
Now run the application:
yarn start:all
This will run all pilets.
The first demo to look at is how to bundle dependencies. It can be started by running
yarn start:bundled
This will run the app shell, pilet-1
and pilet-2
. These pilets both use a library lib
. Since they mention the dependency only in their dependencies
and no where else it is just bundled into the micro frontends.
The second demo to look at is how to centrally share dependencies. It can be started by running
yarn start:central
This will run the app shell (which contains the shared dependency swr
), pilet-3
and pilet-4
. These pilets have swr
in their peerDependencies
telling the piral-cli
that the dependency is supposed to be provided by a consuming application.
The third demo to look at is how to scatter dependencies. It can be started by running
yarn start:scatter
This will run the app shell, pilet-5
(providing / demanded emojis-list@^3.0.0
), pilet-6
(providing emojis-list@3.0.0
while demanding emojis-list@3.x
), and pilet-7
(providing emojis-list@2.0.0
while demanding emojis-list@>=2.0.0
).
The idea behind this one is that all pilets may use the same dependency version, but they may still fall back to their version if nothing was provided already.
Piral and this sample code is released using the MIT license. For more information see the license file.