-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
44 lines (43 loc) · 1.19 KB
/
vite.config.ts
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
base: './', // Use relative paths for all assets
build: {
outDir: '../../dist/build', // Save output directly in the root dist folder
rollupOptions: {
input: {
main: resolve(__dirname, 'src/renderer/index.html'), // Set the entry point
},
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
// Organize assets into folders based on their type
assetFileNames: ({ name }) => {
if (/\.(gif|jpe?g|png|svg)$/.test(name ?? '')) {
return 'assets/images/[name].[ext]';
}
if (/\.(woff|woff2|eot|ttf|otf)$/.test(name ?? '')) {
return 'assets/fonts/[name].[ext]';
}
if (/\.css$/.test(name ?? '')) {
return 'assets/css/[name].[ext]';
}
return 'assets/[name].[ext]';
},
},
},
},
server: {
port: 9000,
open: true,
},
root: 'src/renderer/',
publicDir: '../public',
});