chore: unify build output for both npm and bundle
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,8 +3,8 @@ node_modules/
|
|||||||
|
|
||||||
# Build outputs
|
# Build outputs
|
||||||
dist/
|
dist/
|
||||||
dist-ssr/
|
|
||||||
bundle/
|
bundle/
|
||||||
|
types/
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
|
|||||||
1076
package-lock.json
generated
1076
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@@ -1,25 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "VideoPlayer",
|
"name": "@db/VP",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"description": "VideoPlayer (vp) is a private project at db company to handle hls streams in a modular beautiful html5 video player.",
|
"type": "module",
|
||||||
"keywords": [],
|
"main": "./dist/video-player.cjs.js",
|
||||||
"repository": {
|
"module": "./dist/video-player.es.js",
|
||||||
"type": "git",
|
"types": "./dist/index.d.ts",
|
||||||
"url": "VideoPlayer"
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/video-player.es.js",
|
||||||
|
"require": "./dist/video-player.cjs.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
},
|
||||||
|
"./style.css": "./dist/style.css"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"files": [
|
||||||
"author": "db",
|
"dist",
|
||||||
"type": "commonjs",
|
"README.md"
|
||||||
"main": "index.ts",
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --watch",
|
"dev": "vite build --watch",
|
||||||
"build": "tsc",
|
"build": "tsc && vite build",
|
||||||
"bundle": "vite build",
|
"test": "vitest run",
|
||||||
"test": "vitest",
|
"test:watch": "vitest",
|
||||||
"preview": "vite preview"
|
"lint": "eslint . --ext .ts",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"prepublishOnly": "npm run lint && npm run test && npm run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
|
"eslint": "^9.39.4",
|
||||||
"typescript": "^6.0.3",
|
"typescript": "^6.0.3",
|
||||||
"vite": "^8.0.9",
|
"vite": "^8.0.9",
|
||||||
"vitest": "^4.1.5"
|
"vitest": "^4.1.5"
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"forceConsistentCasingInFileNames": true
|
"forceConsistentCasingInFileNames": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist", "bundle"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import { resolve } from "path";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: resolve(__dirname, "src/index.ts"),
|
entry: "src/index.ts",
|
||||||
name: "VP",
|
name: "VP",
|
||||||
fileName: (format) => `video-player.${format}.js`,
|
fileName: (format) => `video-player.${format}.js`,
|
||||||
formats: ["es", "umd"],
|
formats: ["es", "cjs", "umd"],
|
||||||
},
|
},
|
||||||
outDir: "bundle",
|
minify: "esbuild",
|
||||||
emptyOutDir: true,
|
outDir: "dist",
|
||||||
|
emptyOutDir: false,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["hls.js"],
|
external: ["hls.js"],
|
||||||
output: {
|
output: {
|
||||||
|
|||||||
Reference in New Issue
Block a user