status-web/packages/components/vite.config.ts

49 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-01-13 14:51:21 +00:00
import { tamaguiPlugin } from '@tamagui/vite-plugin'
2023-01-10 11:24:24 +00:00
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
2023-03-13 21:52:43 +00:00
import { dependencies, peerDependencies } from './package.json'
2023-01-10 11:24:24 +00:00
const tamaguiConfig = {
components: [],
2023-01-13 14:51:21 +00:00
config: './src/tamagui.config.ts',
2023-01-10 11:24:24 +00:00
// useReactNativeWebLite: true,
}
2023-03-13 21:52:43 +00:00
const external = [
...Object.keys(dependencies || {}),
...Object.keys(peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
export default defineConfig(({ mode }) => {
return {
define: {
'process.env.TAMAGUI_TARGET': JSON.stringify('web'),
'process.env.INCLUDE_CSS_COLOR_NAMES': JSON.stringify(false),
2023-03-13 21:52:43 +00:00
},
build: {
target: 'es2020',
lib: {
entry: './src/index.tsx',
fileName: 'index',
formats: ['es', 'cjs'],
},
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},
},
plugins: [
react(),
2023-03-13 21:52:43 +00:00
tamaguiPlugin(tamaguiConfig),
// tamaguiExtractPlugin(tamaguiConfig),
2023-03-13 21:52:43 +00:00
],
test: {
environment: 'happy-dom',
},
}
2023-01-10 11:24:24 +00:00
})