From 1a3ed6816c9eaa6551f6697b7acf7dcd0f97df5f Mon Sep 17 00:00:00 2001 From: db123 Date: Thu, 23 Apr 2026 02:01:53 +0330 Subject: [PATCH] ci: corrected building and bundeling with tsc vite --- .gitignore | 1 + package.json | 3 ++- tsconfig.json | 1 - vite.config.ts | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore index c3fb11f..f78acdc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ node_modules/ # Build outputs dist/ dist-ssr/ +bundle/ *.local # TypeScript cache diff --git a/package.json b/package.json index 62da8a7..448e5c4 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "main": "index.ts", "scripts": { "dev": "vite build --watch", - "build": "tsc && vite build", + "build": "tsc", + "bundle": "vite build", "test": "vitest", "preview": "vite preview" }, diff --git a/tsconfig.json b/tsconfig.json index 6fb0455..f2e8774 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "target": "ES2020", "module": "ESNext", "lib": ["ES2020", "DOM", "DOM.Iterable"], - "moduleResolution": "node", "strict": true, "declaration": true, "outDir": "./dist", diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..ee8e0eb --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; + +export default defineConfig({ + build: { + lib: { + entry: resolve(__dirname, "src/index.ts"), + name: "VideoPlayer", + fileName: (format) => `video-player.${format}.js`, + formats: ["es", "umd"], + }, + outDir: "bundle", + emptyOutDir: true, + rollupOptions: { + external: ["hls.js"], + output: { + globals: { + "hls.js": "Hls", + }, + }, + }, + }, +});