-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
29 lines (28 loc) · 975 Bytes
/
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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
base: './',
build: {
sourcemap: true,
target: 'esnext',
rollupOptions: {
output: {
chunkFileNames: '[name]-[hash].js',
entryFileNames: '[name]-[hash].js',
assetFileNames: ({ name }) => {
if (/\.(gif|jpe?g|png|svg)$/.test(name ?? '')) {
return 'assets/images/[name]-[hash][extname]'
}
if (/\.css$/.test(name ?? '')) {
return 'assets/css/[name]-[hash][extname]'
}
// default value
// ref: https://rollupjs.org/guide/en/#outputassetfilenames
return 'assets/[name]-[hash][extname]'
}
}
}
},
plugins: [react()]
})