forked from takeonfaith/LK
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
81 lines (79 loc) · 2.65 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
69
70
71
72
73
74
75
76
77
78
79
80
81
import { babel } from '@rollup/plugin-babel'
import react from '@vitejs/plugin-react'
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import checker from 'vite-plugin-checker'
import svgr from 'vite-plugin-svgr'
import tsconfigPaths from 'vite-tsconfig-paths'
import { version } from './package.json'
export default defineConfig((conf) => {
return {
server: {
open: true,
port: 3000,
proxy: {
'/api': {
target: 'https://e.mospolytech.ru/old/lk_api.php',
secure: false,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
esbuild: {
// jsxInject: (str: string) => (!str.includes('import React') ? "import React from 'react'" : ''),
logOverride: { 'this-is-undefined-in-esm': 'silent' },
},
preview: { port: 3000 },
plugins: [
babel({
presets: [
'@babel/typescript',
'@babel/react',
'patronum/babel-preset',
[
'@babel/preset-env',
{
targets: {
node: 10,
},
useBuiltIns: 'usage',
corejs: 3,
},
],
],
plugins: [['effector/babel-plugin', { factories: [] }]],
extensions: ['.ts', '.tsx'],
babelHelpers: 'bundled',
targets: '>0.25%, iOS>= 13, last 2 versions, not dead',
}),
react({
babel: {
plugins: [
[
'babel-plugin-styled-components',
{
displayName: process.env.NODE_ENV === 'development',
fileName: false,
},
],
],
},
}),
tsconfigPaths(),
svgr(),
splitVendorChunkPlugin(),
checker({ typescript: true, eslint: { lintCommand: 'eslint "./src/**/*.{ts,tsx}"' } }),
],
build: {
outDir: 'build',
manifest: true,
target: 'es2015',
},
optimizeDeps: {
include: ['effector'],
},
define: {
'import.meta.env.VITE_APP_VERSION': JSON.stringify(version),
},
}
})