40 lines
783 B
TypeScript
40 lines
783 B
TypeScript
/// <reference types="vitest" />
|
|
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
import { dependencies, 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({
|
|
// jsxRuntime: 'classic',
|
|
}),
|
|
],
|
|
|
|
test: {
|
|
environment: 'happy-dom',
|
|
},
|
|
}
|
|
})
|