Files
Tyler Slaton 7673b8dfb8 fix(build): load tsdown exports helper as .mjs under native config loader
CI build runners use a Node with native TypeScript stripping enabled
(process.features.typescript), so tsdown selects its native ESM config
loader. That loader cannot resolve the extensionless relative import
"../../scripts/tsdown-exports" in each tsdown.config.ts, so every package
build failed with "Cannot find module" — cascading into the unit, runtime,
and all integration jobs (which run the build first). Local builds used
tsdown's bundler loader instead, which is why this passed pre-push.

Ship the shared helper as scripts/tsdown-exports.mjs (real ESM) plus a
hand-written tsdown-exports.d.mts, imported with the explicit .mjs
extension. This resolves under the native loader, tsdown's bundler loader,
and tsc alike. The generated exports are unchanged — package.json maps stay
identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 20:39:07 -07:00

47 lines
1.1 KiB
TypeScript

import { defineConfig } from "tsdown";
import { withTypesConditions } from "../../scripts/tsdown-exports.mjs";
export default defineConfig([
{
entry: ["src/index.ts"],
format: ["esm", "cjs"],
dts: true,
sourcemap: true,
target: "es2022",
outDir: "dist",
unbundle: true,
loader: {
".css": "text",
".svg": "dataurl",
},
exports: { customExports: withTypesConditions },
},
{
entry: ["src/index.ts"],
format: ["umd"],
globalName: "CopilotKitWebInspector",
sourcemap: true,
target: "es2018",
outDir: "dist",
external: ["lit", "lit/decorators.js"],
loader: {
".css": "text",
".svg": "dataurl",
},
codeSplitting: false,
outputOptions(options) {
options.entryFileNames = "[name].umd.js";
options.globals = {
lit: "Lit",
"lit/decorators.js": "LitDecorators",
"lit/directives/style-map.js": "LitDirectivesStyleMap",
"lit/directives/unsafe-html.js": "LitDirectivesUnsafeHtml",
marked: "marked",
lucide: "lucide",
"@copilotkit/core": "CopilotKitCore",
};
return options;
},
},
]);