-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtsup.config.ts
More file actions
34 lines (31 loc) · 1.12 KB
/
Copy pathtsup.config.ts
File metadata and controls
34 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { readFileSync } from 'node:fs';
import { defineConfig } from 'tsup';
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
// Mirror the original Bun.build() behaviour: keep every declared package
// external so their __dirname-based path resolution stays intact at runtime.
// Without this, esbuild inlines CJS packages (e.g. @vscode/ripgrep) and
// breaks any paths that were relative to the package's own node_modules dir.
const externals: string[] = [
...Object.keys(pkg.dependencies ?? {}),
...Object.keys(pkg.optionalDependencies ?? {}),
...Object.keys(pkg.peerDependencies ?? {}),
];
export default defineConfig({
entry: {
index: 'src/index.ts',
'browser/index': 'src/browser/index.ts',
'browser/server-only-stub': 'src/browser/server-only-stub.ts',
'core/index': 'src/core/index.ts',
'local/index': 'src/local/index.ts',
'server/index': 'src/server/index.ts',
'session/index': 'src/session/index.ts',
'tools/index': 'src/tools/index.ts',
},
format: ['esm'],
target: 'node18',
outDir: 'dist',
minify: true,
clean: true,
dts: false,
external: externals,
});