vite.config.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import { defineConfig } from 'vite'
  2. import path from 'node:path'
  3. import electron from 'vite-plugin-electron/simple'
  4. import vue from '@vitejs/plugin-vue'
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. plugins: [
  8. vue(),
  9. electron({
  10. main: {
  11. // Shortcut of `build.lib.entry`.
  12. entry: 'electron/main.ts',
  13. },
  14. preload: {
  15. // Shortcut of `build.rollupOptions.input`.
  16. // Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
  17. input: path.join(__dirname, 'electron/preload.ts'),
  18. },
  19. // Ployfill the Electron and Node.js API for Renderer process.
  20. // If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process.
  21. // See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer
  22. renderer: process.env.NODE_ENV === 'test'
  23. // https://github.com/electron-vite/vite-plugin-electron-renderer/issues/78#issuecomment-2053600808
  24. ? undefined
  25. : {},
  26. }),
  27. ],
  28. })