ci: corrected building and bundeling with tsc vite

This commit is contained in:
2026-04-23 02:01:53 +03:30
parent 8278e313e5
commit 1a3ed6816c
4 changed files with 26 additions and 2 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ node_modules/
# Build outputs # Build outputs
dist/ dist/
dist-ssr/ dist-ssr/
bundle/
*.local *.local
# TypeScript cache # TypeScript cache

View File

@@ -13,7 +13,8 @@
"main": "index.ts", "main": "index.ts",
"scripts": { "scripts": {
"dev": "vite build --watch", "dev": "vite build --watch",
"build": "tsc && vite build", "build": "tsc",
"bundle": "vite build",
"test": "vitest", "test": "vitest",
"preview": "vite preview" "preview": "vite preview"
}, },

View File

@@ -3,7 +3,6 @@
"target": "ES2020", "target": "ES2020",
"module": "ESNext", "module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"moduleResolution": "node",
"strict": true, "strict": true,
"declaration": true, "declaration": true,
"outDir": "./dist", "outDir": "./dist",

23
vite.config.ts Normal file
View File

@@ -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",
},
},
},
},
});