typescript-sdk/packages/server/tsdown.config.ts
Konstantin Konstantinov 7ba58dac51
v2: cf workers fix (#1843)
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
2026-04-04 08:40:45 +03:00

39 lines
1.3 KiB
TypeScript

import { defineConfig } from 'tsdown';
export default defineConfig({
failOnWarn: 'ci-only',
// 1. Entry Points
// Directly matches package.json include/exclude globs
entry: ['src/index.ts', 'src/shimsNode.ts', 'src/shimsWorkerd.ts', 'src/validators/cfWorker.ts'],
// 2. Output Configuration
format: ['esm'],
outDir: 'dist',
clean: true, // Recommended: Cleans 'dist' before building
sourcemap: true,
// 3. Platform & Target
target: 'esnext',
platform: 'node',
shims: true, // Polyfills common Node.js shims (__dirname, etc.)
// 4. Type Definitions
// Bundles d.ts files into a single output
dts: {
resolver: 'tsc',
// override just for DTS generation:
compilerOptions: {
baseUrl: '.',
paths: {
'@modelcontextprotocol/core': ['../core/src/index.ts'],
'@modelcontextprotocol/core/public': ['../core/src/exports/public/index.ts']
}
}
},
// 5. Vendoring Strategy - Bundle the code for this specific package into the output,
// but treat all other dependencies as external (require/import).
noExternal: ['@modelcontextprotocol/core'],
// 6. External packages - keep self-reference imports external for runtime resolution
external: ['@modelcontextprotocol/server/_shims']
});