forked from graphql/graphiql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
38 lines (33 loc) · 780 Bytes
/
esbuild.js
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
const { build } = require('esbuild');
const [, , arg] = process.argv;
const logger = console;
const isWatchMode = arg === '--watch';
build({
entryPoints: ['src/extension.ts'],
bundle: true,
minify: arg === '--minify',
platform: 'node',
outdir: 'out/',
external: ['vscode', 'ts-node', 'tslib'],
format: 'cjs',
sourcemap: true,
watch: isWatchMode,
})
.then(({ errors, warnings }) => {
if (warnings.length) {
logger.warn(...warnings);
}
if (errors.length) {
logger.error(...errors);
}
logger.log('successfully bundled vscode-graphql-execution 🚀');
if (isWatchMode) {
logger.log('watching... 🕰');
} else {
process.exit();
}
})
.catch(err => {
logger.error(err);
process.exit(1);
});