-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathesbuild.js
More file actions
61 lines (56 loc) 路 1.36 KB
/
Copy pathesbuild.js
File metadata and controls
61 lines (56 loc) 路 1.36 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { globSync } from 'node:fs';
import { createRequire } from 'node:module';
import { sentryEsbuildPlugin } from '@sentry/esbuild-plugin';
import * as esbuild from 'esbuild';
const require = createRequire(import.meta.url);
const esbuildPluginPino = require('esbuild-plugin-pino');
const handlers = globSync('src/handlers/*.ts');
/** @type {import('esbuild').BuildOptions} */
const buildOptions = {
entryPoints: ['src/index.ts', ...handlers],
bundle: true,
platform: 'node',
format: 'esm',
target: 'node22',
external: [
'@discord-player/extractor',
'@kubernetes/client-node',
'bufferutil',
'discord-player',
'discord-player-googlevideo',
'discord-player-spotify',
'discord.js',
'sodium-native',
'zlib-sync',
// Dependencies incompatible with ESM bundling
'@sentry/node',
'pino',
'ioredis',
'ulid',
],
plugins: [
esbuildPluginPino({ transports: [] }),
...(process.env.SENTRY_RELEASE_NAME
? [
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'parsify-tech',
project: 'discord-bot',
telemetry: false,
release: {
name: process.env.SENTRY_RELEASE_NAME,
},
}),
]
: []),
],
outdir: 'dist',
minify: true,
sourcemap: true,
define: {
'process.env.GIT_COMMIT_SHA': JSON.stringify(
process.env.SENTRY_RELEASE_NAME ?? '',
),
},
};
await esbuild.build(buildOptions);