Update vite config for tamagui

This commit is contained in:
RadoslavDimchev 2023-08-03 16:24:19 +03:00
parent 5cddc47a65
commit 130a253024

View File

@ -1,7 +1,41 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { tamaguiPlugin } from '@tamagui/vite-plugin';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
plugins: [react(), tamaguiPlugin({
config: './tamagui.config.ts',
components: ['tamagui'],
}),
// optional, adds the optimizing compiler:
// tamaguiExtractPlugin(tamaguiConfig),
],
define: {
DEV: `${process.env.NODE_ENV === 'development' ? true : false}`,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.TAMAGUI_TARGET': JSON.stringify('web'),
},
resolve: {
alias: {
'react-native': 'react-native-web',
}
},
optimizeDeps: {
esbuildOptions: {
resolveExtensions: [
'.web.js',
'.web.ts',
'.web.tsx',
'.js',
'.jsx',
'.json',
'.ts',
'.tsx',
'.mjs',
],
loader: {
'.js': 'jsx',
},
},
},
});