-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mjs
More file actions
32 lines (29 loc) · 772 Bytes
/
build.mjs
File metadata and controls
32 lines (29 loc) · 772 Bytes
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
import * as esbuild from 'esbuild';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const aliasPlugin = {
name: 'path-alias',
setup(build) {
build.onResolve({ filter: /^@\// }, async (args) => {
return build.resolve(args.path.replace(/^@\//, './'), {
resolveDir: resolve(__dirname, 'src'),
kind: args.kind,
});
});
},
};
await esbuild.build({
entryPoints: [
'src/scripts/appendToBuffer.ts',
'src/scripts/cleanup.ts',
'src/scripts/runDetector.ts',
'src/scripts/runSummarizer.ts',
],
bundle: true,
platform: 'node',
target: 'node18',
outdir: 'scripts',
loader: { '.md': 'text' },
plugins: [aliasPlugin],
});