-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
49 lines (47 loc) · 1.41 KB
/
vite.config.js
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
// vite.config.js
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite';
import babel from '@rollup/plugin-babel';
export default defineConfig({
root: 'src',
resolve: {
alias: { // 기본 디렉토리 정의
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: { // 개발 서버 포트 설정
port: 7600,
},
define: {
'process.env.VERSION': JSON.stringify(process.env.npm_package_version),
},
build: {
outDir: '../dist',
rollupOptions: {
output: {
entryFileNames: `assets/[name]-v${process.env.npm_package_version}.js`,
chunkFileNames: `assets/[name]-[hash]-v${process.env.npm_package_version}.js`,
assetFileNames: ({ name }) => {
if (name.endsWith('.css')) {
return `assets/[name]-v${process.env.npm_package_version}.css`;
}
return 'assets/[name]';
},
},
},
// console.log 제거
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
}
},
plugins: [
babel({
babelHelpers: 'bundled',
extensions: ['.js', '.jsx', '.ts', '.tsx'],
include: ['src/**/*'],
})
]
});