electron-vite / vite-plugin-electron

:electron: Electron⚡️Vite core repo
https://github.com/electron-vite
MIT License
691 stars 56 forks source link

Unable to disable watching #252

Closed probablykasper closed 2 months ago

probablykasper commented 2 months ago

Problem

Setting watch: null does not disable watching. My config:

{
  entry: ['./src/electron/main.ts', './src/electron/preload.ts'],
  vite: {
    watch: null,
    build: {
      outDir: './build/electron',
      emptyOutDir: true,
      rollupOptions: {
        external: [/^.*\.node$/],
      },
    },
  },
}

Workaround

onstart({ startup }) {
  if (process.electronApp) {
    console.log('\x1b[35mNot restarting\x1b[0m')
  } else {
    startup()
  }
}