-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
50 lines (43 loc) · 1.38 KB
/
vite.config.ts
File metadata and controls
50 lines (43 loc) · 1.38 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
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import Icons from 'unplugin-icons/vite';
// import { transformSync } from 'esbuild';
// import path from 'path';
// import fs from 'fs';
// const workersFileRegex = /[\\/]static[\\/]workers[\\/].*\.ts$/;
// function workersTranspilePlugin() {
// return {
// name: 'workers-transpile-plugin',
// async transform(src: string, id: string) {
// if (workersFileRegex.test(id)) {
// try {
// const result = transformSync(src, {
// loader: 'ts',
// format: 'esm',
// });
// const relativePath = path.relative(process.cwd(), id);
// const outputPath = relativePath.replace(/\.ts$/, '.js');
// const outputDir = path.dirname(outputPath);
// if (!fs.existsSync(outputDir)) {
// fs.mkdirSync(outputDir, { recursive: true });
// }
// fs.writeFileSync(outputPath, result.code);
// return {
// code: '',
// map: null
// };
// } catch (error) {
// console.error('Error transforming worker file:', error);
// return null;
// }
// }
// }
// };
// }
export default defineConfig({
plugins: [
sveltekit(),
Icons({ compiler: 'svelte' }),
// workersTranspilePlugin()
]
});