-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.prod.config.ts
48 lines (45 loc) · 1.27 KB
/
vite.prod.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
import { defineConfig } from 'vite'
import { config as configDotEnv } from 'dotenv'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
configDotEnv()
if (process.env.NODE_ENV !== 'production') {
throw new Error('Trying to build project without NODE_ENV=production')
}
export default defineConfig({
define: {
'process.env': process.env
},
plugins: [
react({
babel: {
plugins: [
[
'babel-plugin-styled-components',
{
displayName: true,
fileName: false
},
'babel-plugin-styled-components'
],
[
'@babel/plugin-transform-react-jsx',
{
runtime: 'automatic'
},
'@babel/plugin-transform-react-jsx'
]
]
}
}),
tsconfigPaths(),
],
build: {
minify: false,
sourcemap: true,
target: 'esnext',
commonjsOptions: {
transformMixedEsModules: true,
}
}
})