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

48 lines
985 B
TypeScript
Raw Normal View History

2023-01-17 13:32:04 +00:00
/// <reference types="vitest" />
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { peerDependencies } from './package.json'
const external = [
2023-03-13 20:47:52 +00:00
'@tamagui/core',
'tamagui',
2023-01-17 13:32:04 +00:00
// ...Object.keys(dependencies || {}),
...Object.keys(peerDependencies || {}),
].map(name => new RegExp(`^${name}(/.*)?`))
2023-03-13 20:47:52 +00:00
let index = 0
const TYPES = ['12', '16', '20', 'reactions'] as const
2023-01-17 13:32:04 +00:00
export default defineConfig(({ mode }) => {
return {
build: {
target: 'es2020',
lib: {
2023-03-13 20:47:52 +00:00
entry: TYPES.map(type => `./${type}/index.ts`),
fileName() {
// return `${TYPES[index++]}.${format}.js`
return `${TYPES[index++]}.js`
},
2023-01-17 13:32:04 +00:00
formats: ['es'],
},
sourcemap: true,
emptyOutDir: mode === 'production',
rollupOptions: {
external,
},
},
plugins: [react()],
// plugins: [
// react(),
// ],
test: {
environment: 'happy-dom',
},
}
})