40 lines
763 B
TypeScript
40 lines
763 B
TypeScript
/// <reference types="vitest" />
|
|
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
import { peerDependencies } from './package.json'
|
|
|
|
const external = [
|
|
// ...Object.keys(dependencies || {}),
|
|
...Object.keys(peerDependencies || {}),
|
|
].map(name => new RegExp(`^${name}(/.*)?`))
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
return {
|
|
build: {
|
|
target: 'es2020',
|
|
lib: {
|
|
entry: './src/index.tsx',
|
|
fileName: 'index',
|
|
formats: ['es'],
|
|
},
|
|
sourcemap: true,
|
|
emptyOutDir: mode === 'production',
|
|
rollupOptions: {
|
|
external,
|
|
},
|
|
},
|
|
|
|
plugins: [react()],
|
|
|
|
// plugins: [
|
|
// react(),
|
|
// ],
|
|
|
|
test: {
|
|
environment: 'happy-dom',
|
|
},
|
|
}
|
|
})
|