-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
41 lines (35 loc) · 986 Bytes
/
vite.config.ts
File metadata and controls
41 lines (35 loc) · 986 Bytes
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
import { paraglideVitePlugin } from '@inlang/paraglide-js';
import tailwindcss from '@tailwindcss/vite';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, type PluginOption } from 'vite';
const toolAppRoots = new Set(['/tools/audio-visualizer/app/', '/tools/flowstate/app/']);
function toolsAppIndexRewritePlugin(): PluginOption {
return {
name: 'tools-app-index-rewrite',
configureServer(server) {
server.middlewares.use((req, _res, next) => {
const request = req as { url?: string };
if (!request.url) {
next();
return;
}
const [pathname, query] = request.url.split('?');
if (toolAppRoots.has(pathname)) {
request.url = `${pathname}index.html${query ? `?${query}` : ''}`;
}
next();
});
}
};
}
export default defineConfig({
plugins: [
toolsAppIndexRewritePlugin(),
tailwindcss(),
sveltekit(),
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide'
})
]
});