mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 14:22:02 +00:00
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import * as path from 'path';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { defineConfig } from 'vite';
|
|
import electron from 'vite-plugin-electron/simple';
|
|
import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
export default defineConfig(({ command }) => {
|
|
// Only skip electron plugin during dev server in CI (no display available for Electron)
|
|
// Always include it during build - we need dist-electron/main.js for electron-builder
|
|
const skipElectron =
|
|
command === 'serve' && (process.env.CI === 'true' || process.env.VITE_SKIP_ELECTRON === 'true');
|
|
|
|
return {
|
|
plugins: [
|
|
// Only include electron plugin when not in CI/headless dev mode
|
|
...(skipElectron
|
|
? []
|
|
: [
|
|
electron({
|
|
main: {
|
|
entry: 'src/main.ts',
|
|
vite: {
|
|
build: {
|
|
outDir: 'dist-electron',
|
|
rollupOptions: {
|
|
external: ['electron'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
preload: {
|
|
input: 'src/preload.ts',
|
|
vite: {
|
|
build: {
|
|
outDir: 'dist-electron',
|
|
rollupOptions: {
|
|
external: ['electron'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}),
|
|
]),
|
|
TanStackRouterVite({
|
|
target: 'react',
|
|
autoCodeSplitting: true,
|
|
routesDirectory: './src/routes',
|
|
generatedRouteTree: './src/routeTree.gen.ts',
|
|
}),
|
|
tailwindcss(),
|
|
react(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: parseInt(process.env.TEST_PORT || '3007', 10),
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
},
|
|
};
|
|
});
|