import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from 'path' // https://vite.dev/config/ export default defineConfig(({ command }) => ({ plugins: [react()], build: { // library mode configuration lib: { entry: path.resolve(__dirname, 'src/index.ts'), name: 'CyberDuck', formats: ['es', 'cjs'], fileName: (format) => `cyberduck.${format}.js`, }, rollupOptions: { // don't bundle peer deps external: [ 'react', 'react-dom', 'react-router', 'react-router-dom', 'bootstrap', '@mui/material', '@mui/icons-material', '@emotion/react', '@emotion/styled', 'react-bootstrap', ], output: { globals: { react: 'React', 'react-dom': 'ReactDOM', }, }, }, }, }))