Skip to content

electron-vite/vite-plugin-electron-preload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-electron-preload

A Vite preset adapted to Electron preload

Install

npm i vite-plugin-electron-preload -D

Usage

import electronPreload from 'vite-plugin-electron-preload'

// vite.config.js
export default {
  plugins: [
    electronPreload(/* options */),
  ],
}

API (Define)

electronPreload(options: PreloadOptions)

export interface PreloadOptions {
  /**
   * Must be consistent with the following config.
   * 
   * ```js
   * new BrowserWindow({
   *   webPreferences: {
   *     sandbox: boolean
   *   }
   * })
   * ```
   */
  sandbox?: boolean
  type?: 'commonjs' | 'module'
}