From 78c7d87c0292eaaa57b0fd95a9728637c2f92a2c Mon Sep 17 00:00:00 2001 From: Eugene Olonov Date: Thu, 26 Nov 2026 18:00:20 -0800 Subject: [PATCH] Build only the debug-theme scripts debug-theme is private and only loaded as a script by html2 tests: nothing imports its ESM or CommonJS builds or reads its declaration files. Build the 2 IIFE scripts only and remove the main, types and exports fields that pointed at the other files. Both scripts and their source maps are byte-identical. --- packages/debug-theme/package.json | 18 ------------- packages/debug-theme/tsdown.config.mts | 35 ++++++++------------------ 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/packages/debug-theme/package.json b/packages/debug-theme/package.json index 4b31b88c40..47324adfb4 100644 --- a/packages/debug-theme/package.json +++ b/packages/debug-theme/package.json @@ -2,24 +2,6 @@ "name": "@msinternal/botframework-webchat-debug-theme", "version": "0.0.0-0", "description": "botframework-webchat-debug-theme package", - "main": "./dist/botframework-webchat-debug-theme.js", - "types": "./dist/botframework-webchat-debug-theme.d.ts", - "exports": { - ".": { - "import": { - "types": "./dist/botframework-webchat-debug-theme.d.mts", - "default": "./dist/botframework-webchat-debug-theme.mjs" - }, - "require": { - "types": "./dist/botframework-webchat-debug-theme.d.ts", - "default": "./dist/botframework-webchat-debug-theme.js" - } - }, - "./tsconfig.json": "./src/ts-config/config.json", - "./env": { - "types": "./src/env.d.ts" - } - }, "author": "Microsoft Corporation", "license": "MIT", "private": true, diff --git a/packages/debug-theme/tsdown.config.mts b/packages/debug-theme/tsdown.config.mts index 3d296fdd41..a47c15370c 100644 --- a/packages/debug-theme/tsdown.config.mts +++ b/packages/debug-theme/tsdown.config.mts @@ -2,7 +2,7 @@ import { join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { defineConfig, type Rolldown } from 'tsdown'; -import { createDualFormatConfigs, iifeOptions, type Config } from '../../tsdown.base.config.mts'; +import { applyConfig, iifeOptions, type Config } from '../../tsdown.base.config.mts'; const EXTERNAL_UMD_PATH = join(fileURLToPath(import.meta.url), '../src/external.umd'); @@ -22,31 +22,18 @@ const umdResolvePlugin: Rolldown.Plugin = { } }; -const [esmConfig, cjsConfig] = createDualFormatConfigs( - { 'botframework-webchat-debug-theme': './src/index.ts' }, - { - cjs: config => ({ define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"commonjs"' } }), - esm: config => ({ define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"esmodules"' } }) - } -); - +// Only the scripts are built: the test pages load them, nothing imports the package. function createIIFEConfig(name: 'development' | 'production.min'): Config { - return { - ...esmConfig, - ...iifeOptions(esmConfig), - define: { ...esmConfig.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"global"' }, + return applyConfig(config => ({ + ...config, + ...iifeOptions(config), + define: { ...config.define, 'globalThis.WEB_CHAT_BUILD_INFO_MODULE_FORMAT': '"global"' }, entry: { [`botframework-webchat-debug-theme.${name}`]: './src/bundle.ts' }, - minify: name === 'production.min' || esmConfig.minify, - onSuccess: undefined, - plugins: [...esmConfig.plugins, umdResolvePlugin], + minify: name === 'production.min' || config.minify, + plugins: [...config.plugins, umdResolvePlugin], // Unlike the bundle, the theme scripts are not lowered to ES2019. - target: esmConfig.target - }; + target: config.target + })); } -export default defineConfig([ - esmConfig, - cjsConfig, - createIIFEConfig('development'), - createIIFEConfig('production.min') -]); +export default defineConfig([createIIFEConfig('development'), createIIFEConfig('production.min')]);