/ torrent-streamer / vite.lib.config.ts
vite.lib.config.ts
1 import { defineConfig } from 'vite'; 2 import react from '@vitejs/plugin-react'; 3 import dts from 'vite-plugin-dts'; 4 import { resolve } from 'path'; 5 6 // Library build config 7 export default defineConfig({ 8 plugins: [ 9 react(), 10 dts({ 11 include: ['src'], 12 exclude: ['src/main.tsx', 'src/App.tsx'], 13 }), 14 ], 15 define: { 16 'process.env.NODE_ENV': JSON.stringify('production'), 17 global: 'globalThis', 18 }, 19 build: { 20 lib: { 21 entry: resolve(__dirname, 'src/index.ts'), 22 name: 'TorrentStreamer', 23 formats: ['es'], 24 fileName: 'index', 25 }, 26 rollupOptions: { 27 external: ['react', 'react-dom', 'react/jsx-runtime'], 28 output: { 29 globals: { 30 react: 'React', 31 'react-dom': 'ReactDOM', 32 }, 33 }, 34 }, 35 cssCodeSplit: false, 36 }, 37 });