import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import dts from 'vite-plugin-dts'
import path from 'node:path'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        react(),
        dts({
            insertTypesEntry: true,
        }),
    ],
    build: {
        lib: {
            entry: path.resolve(__dirname, './src/index.tsx'),
            name: 'Registersfe',
            fileName: (format) => `registersfe.${format}.js`,
        },
        rollupOptions: {
            external: [
                'react',
                'react-dom',
                'styled-components',
                // 'react-hook-form',
                // 'react-query',
                '@sofaltaeu/sofaltaeu-components',
                // '@react-oauth/google',
                // 'react-facebook',
                // 'zod',
                // '@hookform/resolvers/zod',
                // '@sofaltaeu/sofaltaeu-utils',
                // 'axios',
                // 'react-lottie',
                // 'use-debounce',
                // 'google-libphonenumber',
            ],
            output: {
                globals: {
                    'react': 'React',
                    'react-dom': 'ReactDOM',
                    'styled-components': 'styled',
                    '@sofaltaeu/sofaltaeu-components':'sofaltaeuComponents'
                    // 'zod': 'zod',
                    // '@hookform/resolvers/zod': 'resolverszod',
                    // 'react-hook-form': 'reactHookForm',
                },
            },
        },
    },
})
