mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
fix: skip electron plugin in CI to prevent X11 display error
The vite-plugin-electron was trying to spawn Electron during the Vite dev server startup, which fails in CI because there's no X11 display. - Use Vite's function config to check command type (serve vs build) - Only skip electron plugin during dev server (command=serve) in CI - Always include electron plugin during build for dist-electron/main.js - Add VITE_SKIP_ELECTRON env var support for explicit control - Update playwright.config.ts to pass VITE_SKIP_ELECTRON in CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,8 @@ export default defineConfig({
|
|||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
VITE_SKIP_SETUP: "true",
|
VITE_SKIP_SETUP: "true",
|
||||||
|
// Skip electron plugin in CI - no display available for Electron
|
||||||
|
VITE_SKIP_ELECTRON: process.env.CI === "true" ? "true" : undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -8,50 +8,63 @@ import { fileURLToPath } from "url";
|
|||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig(({ command }) => {
|
||||||
plugins: [
|
// Only skip electron plugin during dev server in CI (no display available for Electron)
|
||||||
electron({
|
// Always include it during build - we need dist-electron/main.js for electron-builder
|
||||||
main: {
|
const skipElectron =
|
||||||
entry: "src/main.ts",
|
command === "serve" &&
|
||||||
vite: {
|
(process.env.CI === "true" || process.env.VITE_SKIP_ELECTRON === "true");
|
||||||
build: {
|
|
||||||
outDir: "dist-electron",
|
return {
|
||||||
rollupOptions: {
|
plugins: [
|
||||||
external: ["electron"],
|
// 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"),
|
||||||
},
|
},
|
||||||
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: {
|
||||||
server: {
|
port: 5173,
|
||||||
port: 5173,
|
},
|
||||||
},
|
build: {
|
||||||
build: {
|
outDir: "dist",
|
||||||
outDir: "dist",
|
},
|
||||||
},
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user