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-01-20 14:18:05 +00:00
|
|
|
'tamagui',
|
2023-01-17 13:32:04 +00:00
|
|
|
// ...Object.keys(dependencies || {}),
|
|
|
|
...Object.keys(peerDependencies || {}),
|
|
|
|
].map(name => new RegExp(`^${name}(/.*)?`))
|
|
|
|
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
return {
|
|
|
|
build: {
|
|
|
|
target: 'es2020',
|
|
|
|
lib: {
|
2023-01-20 14:18:05 +00:00
|
|
|
entry: [
|
|
|
|
'./src/12/index.ts',
|
|
|
|
'./src/16/index.ts',
|
|
|
|
'./src/20/index.ts',
|
|
|
|
'./src/reactions/index.ts',
|
|
|
|
],
|
|
|
|
fileName(format, entryName) {
|
|
|
|
// const [name] = entryName.split('/')
|
|
|
|
return `icons-${entryName}.${format}.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',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|