-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.worker.config.ts
More file actions
30 lines (27 loc) · 876 Bytes
/
vite.worker.config.ts
File metadata and controls
30 lines (27 loc) · 876 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
import { defineConfig } from 'vite';
import { resolve, basename } from 'path';
import * as glob from 'glob';
// Get all files in the 'src/renderer/workers' directory
const workerFiles = glob.sync('src/renderer/workers/*.ts');
// Create an entry for each worker file
const workerEntries = Object.fromEntries(
workerFiles.map((file) => [
basename(file, '.ts'), // Use the base name of the file as the key
resolve(__dirname, file), // Use the absolute path of the file as the value
])
);
export default defineConfig({
build: {
outDir: '.vite/renderer/main_window/assets/workers',
target: 'esnext',
rollupOptions: {
input: workerEntries,
output: {
format: 'iife',
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
},
},
});