fix(build): switch from umd to cjs format to support dual entry points

Vite does not allow multiple entry points with umd/iife output formats.
Switching to es+cjs enables the private/ sub-package build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
徐勤民 2026-05-18 21:18:02 +08:00
父节点 7054cb7c4f
当前提交 b25ae21760
共有 3 个文件被更改,包括 6 次插入6 次删除

查看文件

@ -6,19 +6,19 @@
"publishConfig": { "publishConfig": {
"registry": "https://nexus.xuqinmin.com/repository/npm-hosted/" "registry": "https://nexus.xuqinmin.com/repository/npm-hosted/"
}, },
"main": "dist/index.umd.js", "main": "dist/index.cjs.js",
"module": "dist/index.es.js", "module": "dist/index.es.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"import": "./dist/index.es.js", "import": "./dist/index.es.js",
"require": "./dist/index.umd.js" "require": "./dist/index.cjs.js"
}, },
"./private": { "./private": {
"types": "./dist/private/index.d.ts", "types": "./dist/private/index.d.ts",
"import": "./dist/private/index.es.js", "import": "./dist/private/index.es.js",
"require": "./dist/private/index.umd.js" "require": "./dist/private/index.cjs.js"
} }
}, },
"files": [ "files": [

查看文件

@ -6,14 +6,14 @@
"publishConfig": { "publishConfig": {
"registry": "https://nexus.xuqinmin.com/repository/npm-hosted/" "registry": "https://nexus.xuqinmin.com/repository/npm-hosted/"
}, },
"main": "dist/private/index.umd.js", "main": "dist/private/index.cjs.js",
"module": "dist/private/index.es.js", "module": "dist/private/index.es.js",
"types": "dist/private/index.d.ts", "types": "dist/private/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./dist/private/index.d.ts", "types": "./dist/private/index.d.ts",
"import": "./dist/private/index.es.js", "import": "./dist/private/index.es.js",
"require": "./dist/private/index.umd.js" "require": "./dist/private/index.cjs.js"
} }
}, },
"files": [ "files": [

查看文件

@ -11,7 +11,7 @@ export default defineConfig({
'private/index': resolve(__dirname, 'src/private/index.ts'), 'private/index': resolve(__dirname, 'src/private/index.ts'),
}, },
name: 'XuqmH5SDK', name: 'XuqmH5SDK',
formats: ['es', 'umd'], formats: ['es', 'cjs'],
fileName: (format, entryName) => `${entryName}.${format}.js`, fileName: (format, entryName) => `${entryName}.${format}.js`,
}, },
rollupOptions: { rollupOptions: {