36 lines
939 B
TypeScript
36 lines
939 B
TypeScript
import { resolve } from 'node:path';
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import dts from 'vite-plugin-dts';
|
|
import pkg from './package.json';
|
|
|
|
const external = [...Object.keys(pkg.peerDependencies), ...Object.keys(pkg.dependencies)];
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
dts({
|
|
tsconfigPath: './tsconfig.build.json',
|
|
exclude: ['**/*.stories.tsx', 'src/stories/**'],
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: { '@': resolve(__dirname, 'src') },
|
|
},
|
|
// `public/` only holds Storybook sample assets.
|
|
publicDir: false,
|
|
build: {
|
|
lib: {
|
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
formats: ['es'],
|
|
fileName: 'index',
|
|
cssFileName: 'collabry',
|
|
},
|
|
rollupOptions: {
|
|
external: (id) => external.some((dep) => id === dep || id.startsWith(`${dep}/`)),
|
|
},
|
|
},
|
|
});
|