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 startThe 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.