diff --git a/package.json b/package.json index 184e2e06..a64d0079 100644 --- a/package.json +++ b/package.json @@ -7,18 +7,15 @@ "pnpm": ">=6" }, "author": "shiyiya", - "keywords": [ - "oplayer", - "video-player" - ], + "keywords": ["oplayer", "video-player"], "scripts": { "watch": "pnpm --parallel run start", "start": "pnpm run watch", "dev": "pnpm --filter=!@oplayer/docs --parallel run start", "dev:exam": "cd examples/standalone && pnpm run start", "dev:ui": "pnpm --filter=@oplayer/ui run start", - "build": "pnpm --filter=!@oplayer/docs run build", - "build:packs": "pnpm --filter=@oplayer/* run build", + "build": "pnpm --filter=!@oplayer/docs run build && cp -r packages/ui/dist/index.ui.js packages/core/dist", + "build:packs": "pnpm --filter=@oplayer/* run build && cp -r packages/ui/dist/index.ui.js packages/core/dist", "build:core": "pnpm --filter=@oplayer/core run build", "build:docs": "pnpm --filter=@oplayer/docs run build", "build:plugins": "pnpm --filter=@oplayer/plugins run build", diff --git a/packages/core/package.json b/packages/core/package.json index 54d419e1..25c0759d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -6,6 +6,10 @@ "main": "./dist/index.es.js", "types": "./dist/src/index.d.ts", "browser": "./dist/index.min.js", + "exports": { + "import": "./dist/index.es.js", + "require": "./dist/index.min.js" + }, "sideEffects": false, "author": "shiyiya", "homepage": "https://github.com/shiyiya/oplayer", diff --git a/packages/hls/package.json b/packages/hls/package.json index ad4c29a6..213e9b6c 100644 --- a/packages/hls/package.json +++ b/packages/hls/package.json @@ -16,8 +16,7 @@ "scripts": { "start": "concurrently -n es,dts \"vite build --watch\" \"tsc --emitDeclarationOnly --watch\"", "tsc": "tsc --noEmit && echo", - "build:extra": "vite build --config vite.all.config.ts", - "build": "vite build && tsc --emitDeclarationOnly && pnpm run build:extra" + "build": "vite build && tsc --emitDeclarationOnly" }, "files": [ "dist", diff --git a/packages/hls/vite.all.config.ts b/packages/hls/vite.all.config.ts deleted file mode 100644 index 8f531b31..00000000 --- a/packages/hls/vite.all.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { viteConfig } from '../../vite.config' - -export default viteConfig('hls', { - build: { - emptyOutDir: false, - rollupOptions: { external: ['@oplayer/core'] }, - lib: { - name: 'OHls', - fileName: () => 'index.hls.js', - formats: ['umd'] - } as any - } -}) diff --git a/packages/ui/package.json b/packages/ui/package.json index 10e5060a..1f6bdcc6 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -6,6 +6,10 @@ "main": "./dist/index.es.js", "types": "./dist/src/index.d.ts", "browser": "./dist/index.min.js", + "exports": { + "import": "./dist/index.es.js", + "require": "./dist/index.min.js" + }, "sideEffects": false, "author": "shiyiya", "homepage": "https://github.com/shiyiya/oplayer", diff --git a/packages/ui/vite.core.config.ts b/packages/ui/vite.core.config.ts index 8af5e3b0..53b37611 100644 --- a/packages/ui/vite.core.config.ts +++ b/packages/ui/vite.core.config.ts @@ -4,7 +4,6 @@ import { viteConfig } from '../../vite.config' import { version as CoreVersion, name as CoreName, author, description, homepage } from '../core/package.json' import { version as UIVersion, name as UIName } from '../ui/package.json' import { plugin } from 'vite-plugin-merge-exports' -import { cpSync } from 'node:fs' export default viteConfig( 'ui', @@ -12,8 +11,7 @@ export default viteConfig( build: { emptyOutDir: false, rollupOptions: { - external: [], - output: { dir: '../core/dist' } + external: [] }, lib: { entry: './src/index.core.ts', @@ -24,15 +22,9 @@ export default viteConfig( }, plugins: [ banner({ - outDir: '../core/dist', content: `/**\n * name: ${CoreName} + ${UIName}\n * version: v${CoreVersion} + v${UIVersion}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */` }), - plugin(), - { - closeBundle() { - cpSync('../core/dist/index.ui.js', './dist/index.ui.js') - } - } + plugin() ] }, false