-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
75 lines (72 loc) · 1.88 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
/// <reference types="vitest"/>
import {defineConfig} from 'vite';
import {tamaguiPlugin, tamaguiExtractPlugin} from '@tamagui/vite-plugin';
import {visualizer} from 'rollup-plugin-visualizer';
import {lingui} from '@lingui/vite-plugin';
import react from '@vitejs/plugin-react';
import tsPaths from 'vite-tsconfig-paths';
const tamagui = {
config: 'src/theme/config.ts',
components: ['tamagui'],
useReactNativeWebLite: true,
};
export default defineConfig(config => {
const isDev = config.mode === 'development';
return {
clearScreen: true,
plugins: [
tsPaths(),
lingui(),
tamaguiPlugin(tamagui),
tamaguiExtractPlugin(tamagui),
react({babel: {plugins: ['macros']}}),
visualizer(),
],
define: {
global: 'window',
__DEV__: isDev,
...isDev && {
process: {
env: {
DEV: JSON.stringify('true'),
NODE_ENV: JSON.stringify('development'),
},
},
},
},
resolve: {
resolveExtensions: [
'.web.js',
'.web.ts',
'.web.tsx',
'.js',
'.jsx',
'.json',
'.ts',
'.tsx',
'.mjs',
],
loader: {
'.js': 'jsx',
},
alias: {
'react-native': 'react-native-web',
'react-native-maps': 'react-native-web-maps',
'react-native-webview': 'react-native-web-webview',
'react-native-vector-icons/MaterialIcons': 'react-native-vector-icons/dist/MaterialIcons',
'lottie-react-native': 'react-native-web-lottie',
'recyclerlistview': 'recyclerlistview/web',
// TIP: add package aliases here as needed
},
},
build: {
outDir: 'dist/web',
chunkSizeWarningLimit: 600,
rollupOptions: {
output: {
manualChunks: id => id.includes('node_modules') ? 'vendor' : null,
}
}
},
};
});