Vite
Add the Nodepod plugin to your Vite configuration:
import { defineConfig } from 'vite';import nodepod from '@scelar/nodepod/vite';
export default defineConfig({ plugins: [nodepod()],});The plugin serves the service worker, process worker, and preview bridge during development and emits the required assets during production builds. It must run on the origin where the Nodepod host page loads.
Then boot the runtime from application code:
import { Nodepod } from '@scelar/nodepod';
const pod = await Nodepod.boot();If the asset path must change, pass the same path to both sides:
nodepod({ path: '/runtime/nodepod-sw.js' })
// application codeNodepod.boot({ swUrl: '/runtime/nodepod-sw.js' })For clean production preview hostnames and required headers, continue to Preview deployment.