-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathesbuild.js
More file actions
50 lines (45 loc) · 1.15 KB
/
Copy pathesbuild.js
File metadata and controls
50 lines (45 loc) · 1.15 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
const fs = require('node:fs');
const { build } = require('esbuild');
const baseConfig = {
bundle: true,
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV !== 'production'
};
const extensionConfig = {
...baseConfig,
platform: 'node',
format: 'cjs',
entryPoints: ['./src/extension.ts'],
outfile: './out/extension.js',
external: ['vscode']
};
const webviewsConfig = {
...baseConfig,
target: 'es2020',
format: 'esm',
entryPoints: fs.readdirSync('./src/webviews')
.filter(file => file.endsWith('.tsx'))
.map(file => `./src/webviews/${file}`),
outdir: './out/webviews',
splitting: true
};
const scriptsConfig = {
bundle: true,
platform: 'node',
format: 'cjs',
entryPoints: ['./src/scripts/update-contributes.ts'],
outfile: './scripts/update-contributes.js',
alias: {
'vscode': './vscode-shim.js'
}
};
(async () => {
try {
await build(extensionConfig);
await build(webviewsConfig);
await build(scriptsConfig);
} catch (err) {
process.stderr.write(err.stderr);
process.exit(1);
}
})();