This example shows how to load the Universal Viewer CommonJS build (dist/cjs/index.js) into an Electron renderer process.
From npm-examples/electron-cjs-example:
npm installnpm startTo open a specific Universal Viewer manifest, pass it as a CLI argument:
npm start -- --manifest=https://example.org/iiif/manifestor as the first positional argument:
npm start -- https://example.org/iiif/manifestThe TypeScript source files are in src/, and compiled output is written to dist/ before Electron starts.
npm run buildThis packages the example as a Windows desktop app into release/ using electron-packager.
The Electron window loads the Universal Viewer using require('universalviewer/dist/cjs/index.js') inside the renderer.
src/renderer.ts also installs a runtime hook for .css and .less imports so the Universal Viewer CJS package can load its styles correctly in Electron.