-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathesbuild.js
45 lines (42 loc) · 1.1 KB
/
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
39
40
41
42
43
44
45
const { build } = require('esbuild');
const { copy } = require('esbuild-plugin-copy');
const production = process.argv.includes('--production');
async function main() {
const files = {
'images/**': './images',
'snippets/**': './snippets',
'syntaxes/**': './syntaxes',
'CHANGELOG.md': './CHANGELOG.md',
'LICENSE.md': './LICENSE.md',
'README.md': './README.md',
'language-configuration.json': './language-configuration.json',
'package.json': './package.json',
'language-server/build/libs/language-server-all.jar': 'bin',
'node_modules/mermaid/dist/mermaid.min.js': 'media',
};
await build({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'build/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
copy({
assets: Object.entries(files).map(([from, to]) => {
return { from, to };
}),
}),
],
});
}
main().catch(e => {
console.error(e);
process.exit(1);
});