34 lines
828 B
TypeScript
34 lines
828 B
TypeScript
import react from '@vitejs/plugin-react';
|
|
import path from 'node:path';
|
|
import { defineConfig } from 'vite';
|
|
import dts from 'vite-plugin-dts';
|
|
|
|
export default defineConfig({
|
|
define: {
|
|
'process.env': {}
|
|
},
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
insertTypesEntry: true,
|
|
}),
|
|
],
|
|
build: {
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
name: 'components',
|
|
formats: ['es', 'umd'],
|
|
fileName: (format) => `components.${format}.js`,
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'styled-components'],
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM'
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|