From b25ae21760a40e2aaedfa05760d8c94afe6cac94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Mon, 18 May 2026 21:18:02 +0800 Subject: [PATCH] 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 --- package.json | 6 +++--- package.private.json | 4 ++-- vite.config.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 954da02..1ca638a 100644 --- a/package.json +++ b/package.json @@ -6,19 +6,19 @@ "publishConfig": { "registry": "https://nexus.xuqinmin.com/repository/npm-hosted/" }, - "main": "dist/index.umd.js", + "main": "dist/index.cjs.js", "module": "dist/index.es.js", "types": "dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.es.js", - "require": "./dist/index.umd.js" + "require": "./dist/index.cjs.js" }, "./private": { "types": "./dist/private/index.d.ts", "import": "./dist/private/index.es.js", - "require": "./dist/private/index.umd.js" + "require": "./dist/private/index.cjs.js" } }, "files": [ diff --git a/package.private.json b/package.private.json index d66ea78..8252855 100644 --- a/package.private.json +++ b/package.private.json @@ -6,14 +6,14 @@ "publishConfig": { "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", "types": "dist/private/index.d.ts", "exports": { ".": { "types": "./dist/private/index.d.ts", "import": "./dist/private/index.es.js", - "require": "./dist/private/index.umd.js" + "require": "./dist/private/index.cjs.js" } }, "files": [ diff --git a/vite.config.ts b/vite.config.ts index d23db33..11c96ff 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ 'private/index': resolve(__dirname, 'src/private/index.ts'), }, name: 'XuqmH5SDK', - formats: ['es', 'umd'], + formats: ['es', 'cjs'], fileName: (format, entryName) => `${entryName}.${format}.js`, }, rollupOptions: {