status-web/apps/web/vite.config.ts

40 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2023-01-13 14:51:21 +00:00
import { tamaguiPlugin } from '@tamagui/vite-plugin'
2023-01-10 11:25:26 +00:00
import react from '@vitejs/plugin-react-swc'
2023-03-14 12:48:09 +00:00
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
2023-01-10 11:25:26 +00:00
2023-01-11 13:38:47 +00:00
import type { PluginOption } from 'vite'
2023-01-10 11:25:26 +00:00
const tamaguiConfig = {
components: ['@status-im/components'],
2023-01-11 13:38:47 +00:00
config: './tamagui.config.ts',
2023-01-10 11:25:26 +00:00
// useReactNativeWebLite: true,
}
2023-03-14 12:48:09 +00:00
// @see: https://vitejs.dev/config
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
resolve: {
// mainFields: ['module', 'jsnext:main', 'jsnext'],
alias: {
'@status-im/components/hooks': path.resolve(
'../../packages/components/hooks'
),
'@status-im/components': path.resolve('../../packages/components/src'),
},
},
define: {
// @see https://github.com/tamagui/tamagui/blob/a0d5fa0d05e6988a7cfa2a5e7823f295b82bae10/packages/tamagui/src/setup.ts#LL20C1-L20C28
global: 'globalThis',
'process.env.TAMAGUI_TARGET': JSON.stringify(env.TAMAGUI_TARGET),
2023-03-14 12:48:09 +00:00
},
plugins: [
react(),
tamaguiPlugin(tamaguiConfig) as PluginOption,
// tamaguiExtractPlugin(tamaguiConfig)
],
}
2023-01-10 11:25:26 +00:00
})