-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
47 lines (45 loc) · 1.41 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
45
46
47
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
const PORT = 5173;
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
base: './', // Ensures relative paths in imports
build: {
outDir: 'dist', // Output directory
assetsDir: '', // Place assets in the same directory as index.html
sourcemap: false,
emptyOutDir: true,
rollupOptions: {
output: {
entryFileNames: 'js/[name].js', // No subfolder for entry files
chunkFileNames: 'js/[name]-[hash].js', // No subfolder for chunks
assetFileNames: ({ name }) => {
if (/\.(woff2?|eot|ttf|otf)$/.test(name ?? '')) {
return 'fonts/[name][extname]'
}
if (/\.(png|jpe?g|gif|svg|lottie)$/.test(name ?? '')) {
return 'img/[name][extname]'
}
if (/\.css$/.test(name ?? '')) {
return 'css/[name][extname]' // Ensures CSS goes into 'css/' folder
}
if (/\.js$/.test(name ?? '')) {
return 'js/[name][extname]' // Ensures CSS goes into 'css/' folder
}
return '[name][extname]'
},
}
}
},
server: {
port: PORT,
proxy: {
"/getExample": {
target: `http://localhost:${PORT}`, // Redirect to public file
changeOrigin: false,
rewrite: () => "/SignalExample.rsp", // Rewrite URL
},
},
},
})