import { defineConfig } from 'tsdown';
// List of Node.js built-in modules to externalize
const external = [
'fs',
'path',
'url',
'util',
'stream',
'events',
'buffer',
'crypto',
'http',
'https',
'net',
'os',
'process',
'querystring',
'string_decoder',
'timers',
'tty',
'zlib',
'child_process',
'assert',
'constants',
'module',
'perf_hooks',
'readline',
'repl',
'tls',
'dgram',
'dns',
'domain',
'punycode',
'vm',
'worker_threads',
'v8',
'async_hooks',
'inspector',
'node:fs',
'node:path',
'node:url',
'node:util',
'node:stream',
'node:events',
'node:buffer',
'node:crypto',
'node:http',
'node:https',
'node:net',
'node:os',
'node:process',
'node:querystring',
'node:string_decoder',
'node:timers',
'node:tty',
'node:zlib',
'node:child_process',
'node:assert',
'node:constants',
'node:module',
'node:perf_hooks',
'node:readline',
'node:repl',
'node:tls',
'node:dgram',
'node:dns',
'node:domain',
'node:punycode',
'node:vm',
'node:worker_threads',
'node:v8',
'node:async_hooks',
'node:inspector',
/^node:.*/,
];
export default defineConfig({
entry: {
index: 'src/index.ts',
plugin: 'src/plugin.ts',
},
format: ['esm', 'cjs'],
clean: true,
shims: true,
dts: true,
exports: true,
unbundle: false,
// Externalize Node.js built-ins only
external,
// Bundle everything else (forces bundling of all npm packages)
noExternal: [/.*/],
onSuccess: async () => {
console.log('✓ Plugin built - dependencies bundled for Clawdbot');
},
});