-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (51 loc) · 1.43 KB
/
Copy pathvite.config.ts
File metadata and controls
53 lines (51 loc) · 1.43 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
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
import express from "express";
import { join } from "path";
import { fileURLToPath } from "url";
const __dirname = fileURLToPath(new URL(".", import.meta.url));
export default defineConfig({
plugins: [
remix({
appDirectory: "case",
future: {
v3_fetcherPersist: true,
v3_lazyRouteDiscovery: true,
v3_relativeSplatPath: true,
v3_singleFetch: true,
v3_throwAbortReason: true,
},
}),
tailwindcss(),
{
name: 'serve-base-files',
configureServer(server) {
// Serve the base folder from the parent directory with caching headers
server.middlewares.use('/base', express.static(join(__dirname, 'base'), {
maxAge: '1y',
immutable: true,
setHeaders: (res, path) => {
// Set cache headers for audio files
if (path.endsWith('.wav') || path.endsWith('.mp3')) {
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
}
}
}));
}
}
],
publicDir: join(__dirname, 'case/public'),
server: {
fs: {
// Allow serving files from parent directory
allow: ['..']
},
warmup: {
clientFiles: ['case/entry.client.tsx'],
}
},
optimizeDeps: {
entries: ['case/entry.client.tsx'],
}
});