65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import dts from 'vite-plugin-dts'
|
|
import path from 'path'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
dts({
|
|
include: ['src/**/*'],
|
|
exclude: ['src/**/*.test.ts', 'src/**/*.test.tsx', 'examples'],
|
|
outDir: 'dist',
|
|
insertTypesEntry: true,
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
build: {
|
|
copyPublicDir: false,
|
|
lib: {
|
|
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
name: 'VideoPlayer',
|
|
formats: ['es', 'umd'],
|
|
fileName: (format) => `video-player.${format === 'es' ? 'js' : 'umd.cjs'}`,
|
|
},
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
drop_debugger: true,
|
|
passes: 2,
|
|
},
|
|
mangle: {
|
|
safari10: true,
|
|
},
|
|
format: {
|
|
comments: false,
|
|
},
|
|
},
|
|
rollupOptions: {
|
|
external: ['react', 'react-dom', 'react/jsx-runtime', 'hls.js', 'flv.js'],
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'react/jsx-runtime': 'jsxRuntime',
|
|
'hls.js': 'Hls',
|
|
'flv.js': 'flvjs',
|
|
},
|
|
compact: true,
|
|
},
|
|
treeshake: {
|
|
moduleSideEffects: false,
|
|
propertyReadSideEffects: false,
|
|
},
|
|
},
|
|
cssCodeSplit: false,
|
|
cssMinify: true,
|
|
},
|
|
})
|