-
Notifications
You must be signed in to change notification settings - Fork 5
/
bob-esbuild.config.ts
40 lines (35 loc) · 1.02 KB
/
bob-esbuild.config.ts
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
import { readFileSync } from 'fs';
import { resolve, sep } from 'path';
const isHelixGraphiql = process.cwd().endsWith(sep + 'graphiql');
export const config: import('bob-esbuild').BobConfig = {
tsc: {
dirs: ['packages/*/*', 'internal/*'],
},
verbose: false,
outputOptions: {
sourcemap: false,
interop(moduleName) {
if (moduleName) {
if (moduleName.startsWith('ws')) return 'esModule';
if (moduleName.startsWith('graphql-upload/public/')) return 'defaultOnly';
}
return 'auto';
},
},
esbuildPluginOptions: isHelixGraphiql
? {
target: 'node13.2',
define: (() => {
const packageJson = JSON.parse(
readFileSync(resolve(process.cwd(), './package.json'), {
encoding: 'utf-8',
})
);
return {
__GRAPHIQL_PKG_NAME__: JSON.stringify(packageJson.name),
__GRAPHIQL_PKG_VERSION__: JSON.stringify(packageJson.version),
};
})(),
}
: undefined,
};