-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
68 lines (64 loc) · 1.4 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
/* eslint-disable import/no-extraneous-dependencies */
import {
defineConfig,
splitVendorChunkPlugin,
UserConfig,
} from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { esbuildPluginBabel } from 'vite-plugin-babel';
/* eslint-enable import/no-extraneous-dependencies */
const basePath = dirname(fileURLToPath(import.meta.url));
const defaultConfig: UserConfig = {
plugins: [
splitVendorChunkPlugin(),
esbuildPluginBabel(),
tsconfigPaths(),
],
resolve: {
alias: {
'@': resolve(basePath, './src'),
},
},
css: {
// postcss 설정 경로
postcss: 'postcss.config.cjs',
// CSS 전처리기에 전달할 설정
// preprocessorOptions: {
// scss: {
// additionalData: '',
// },
// },
},
esbuild: {
// jsxInject: 'import React from \'react\';',
},
clearScreen: false,
};
export default defineConfig(({ command /* , mode */ }) => {
// 로컬 개발용 설정
if (command === 'serve') {
return {
...defaultConfig,
css: {
devSourcemap: true,
},
server: {
host: true,
port: 8080,
open: true,
hmr: true,
},
};
}
return {
...defaultConfig,
build: {
target: 'es2015',
sourcemap: true,
manifest: true,
emptyOutDir: true,
},
};
});