forked from Cloud-Pipelines/pipeline-editor
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.config.ghpages.js
More file actions
77 lines (75 loc) · 2.15 KB
/
vite.config.ghpages.js
File metadata and controls
77 lines (75 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import tailwindcss from "@tailwindcss/vite";
import viteReact from "@vitejs/plugin-react";
import path from "path";
import { fileURLToPath } from "url";
import { defineConfig } from "vite";
// Create __dirname equivalent for ES modules
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig({
plugins: [viteReact(), tailwindcss()],
// Set base path for GitHub Pages deployment
// This ensures all assets and routes are prefixed with /pipeline-studio-app/
base: "/tangle-ui/",
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
// Configure preview server
preview: {
port: 4173,
strictPort: false,
host: "localhost",
open: "/tangle-ui/", // Auto-open browser at the correct path
},
// Build configuration optimized for GitHub Pages
build: {
// Output directory (default: dist)
outDir: "dist",
// Ensure relative asset paths within the base path
assetsDir: "assets",
// Configure rollup for proper asset handling
rollupOptions: {
output: {
// Consistent naming for chunks and assets
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: ({ name }) => {
// Organize assets by type
if (/\.(gif|jpe?g|png|svg|ico|webp)$/.test(name ?? "")) {
return "assets/images/[name]-[hash][extname]";
}
if (/\.css$/.test(name ?? "")) {
return "assets/css/[name]-[hash][extname]";
}
return "assets/[name]-[hash][extname]";
},
},
},
// Ensure source maps for debugging
sourcemap: true,
},
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./vitest-setup.js"],
include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
exclude: [
"node_modules/",
"test/",
"tests/",
"tests/e2e/",
"*.test.tsx",
"*.test.ts",
"*.d.ts",
],
},
},
optimizeDeps: {
exclude: ["lucide-react"],
},
});