Using Picard.js in an Electron App
In Electron, micro frontends are rendered in the renderer process, which is a regular web page. So Picard.js runs there like on any website:
Without a bundler, reference the browser variant from the installed package:
html<script src="../node_modules/picard-js/dist/browser/picard.js" feed="https://feed.piral.cloud/api/v1/microfrontends/picard-demos"></script>With a bundler (e.g., Electron Forge with Vite or webpack), import
initializePicardfrom the client variant.
The main process doesn't need Picard.js.
Things to Consider
- Origin. A renderer loaded with
loadFilehas afile://origin. Remote micro frontends need CORS headers. - Content Security Policy. If you set one, allow the origins of the feed and the micro frontends, and
blob:scripts (used for ES modules with shared dependencies). - Packaging. When
picard-jsis a regular dependency, Electron Forge packages it, so relative paths intonode_moduleskeep working in the packaged app.
👉 See the Electron sample. Tauri works the same way, with picard-js/client in the webview. More in Desktop & Mobile Apps.