A Vite preset adapted to Electron preload
npm i vite-plugin-electron-preload -D
import electronPreload from 'vite-plugin-electron-preload'
// vite.config.js
export default {
plugins: [
electronPreload(/* options */),
],
}
electronPreload(options: PreloadOptions)
export interface PreloadOptions {
/**
* Must be consistent with the following config.
*
* ```js
* new BrowserWindow({
* webPreferences: {
* sandbox: boolean
* }
* })
* ```
*/
sandbox?: boolean
type?: 'commonjs' | 'module'
}