import { resolve } from 'node:path' import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' export default defineConfig({ main: { plugins: [externalizeDepsPlugin()], }, preload: { plugins: [externalizeDepsPlugin()], // CJS, не ESM: Electron дважды выполняет ESM-preload, и contextBridge падает. build: { rollupOptions: { output: { format: 'cjs', inlineDynamicImports: true, entryFileNames: 'index.cjs', }, }, }, }, renderer: { resolve: { alias: { '@renderer': resolve('src/renderer/src'), '@shared': resolve('src/shared'), }, }, plugins: [react(), tailwindcss()], }, })