From 1fd4cb6d7c808c642100f255c6deb5606c41a15b Mon Sep 17 00:00:00 2001 From: wfc Date: Tue, 3 Dec 2024 19:13:04 +0800 Subject: [PATCH] feat: comments --- config/rslib-config/index.ts | 9 +++++++-- packages/coze-js/rslib.config.ts | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/rslib-config/index.ts b/config/rslib-config/index.ts index 5617c51b..c8ee5e21 100644 --- a/config/rslib-config/index.ts +++ b/config/rslib-config/index.ts @@ -1,7 +1,7 @@ import { defineConfig, LibConfig } from '@rslib/core'; type LibFormat = LibConfig['format']; -export type BundleType = Boolean | 'excludeExternal'; +export type BundleType = boolean | 'excludeExternal'; interface Options { format?: LibFormat[]; @@ -21,8 +21,13 @@ function getRslibConfig(options: Options) { }; const libs = format.map(libFormat => { - const lib = getLibShared(libFormat, bundle!); + const lib = getLibShared(libFormat, bundle); if (libFormat === 'umd') { + if (!umdName) { + throw new Error( + 'getRslibConfig: umdName is required when using UMD format', + ); + } lib.umdName = umdName; lib.bundle = true; } diff --git a/packages/coze-js/rslib.config.ts b/packages/coze-js/rslib.config.ts index bea3a6d4..652f23cd 100644 --- a/packages/coze-js/rslib.config.ts +++ b/packages/coze-js/rslib.config.ts @@ -4,7 +4,6 @@ export default defineConfig( getRslibConfig({ format: ['esm', 'cjs', 'umd'], bundle: 'excludeExternal', - umdName: 'CozeJs', tsconfigPath: './tsconfig.build.json', }), );