import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { fileURLToPath } from 'node:url'; export default defineConfig({ plugins: [react()], build: { lib: { entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)), name: 'ReactCalendario', formats: ['es', 'umd'], fileName: (format) => `index.${format}.js` }, rollupOptions: { external: ['react', 'react-dom', 'react/jsx-runtime'], output: { globals: { react: 'React', 'react-dom': 'ReactDOM', 'react/jsx-runtime': 'react/jsx-runtime' } } }, outDir: 'dist', sourcemap: true, emptyOutDir: false }, css: { modules: { generateScopedName: 'rc_[local]_[hash:base64:5]' } } });