Files
2026-09-29 13:50:01 +03:00

26 lines
728 B
JavaScript

import { build } from 'esbuild';
import path from 'node:path';
// Bundle workspace packages (they ship TypeScript sources), keep npm dependencies external.
const externalNpmPackages = {
name: 'external-npm-packages',
setup(b) {
b.onResolve({ filter: /.*/ }, (args) => {
if (args.kind === 'entry-point' || args.path.startsWith('.') || path.isAbsolute(args.path)) return undefined;
if (args.path.startsWith('@cardy/')) return undefined;
return { path: args.path, external: true };
});
},
};
await build({
entryPoints: ['src/index.ts'],
outfile: 'dist/index.js',
bundle: true,
platform: 'node',
format: 'esm',
target: 'node22',
sourcemap: true,
plugins: [externalNpmPackages],
});