bad1cc6ca0
Introduces internationalization (i18n) support with English and Turkish, adds unit tests and test setup with Vitest and React Testing Library, and updates documentation including README and changelog. Removes legacy publishing and usage guides, refactors components to use translation system, and updates build and test scripts in package.json. Also adds new utility modules for HLS and CORS, and improves PlayerContext and SettingsMenu for language support.
62 lines
1.3 KiB
TypeScript
62 lines
1.3 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: {
|
|
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', 'hls.js'],
|
|
output: {
|
|
globals: {
|
|
react: 'React',
|
|
'react-dom': 'ReactDOM',
|
|
'hls.js': 'Hls',
|
|
},
|
|
compact: true,
|
|
},
|
|
treeshake: {
|
|
moduleSideEffects: false,
|
|
propertyReadSideEffects: false,
|
|
},
|
|
},
|
|
cssCodeSplit: false,
|
|
cssMinify: true,
|
|
},
|
|
})
|