File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change
1
+ import * as esbuild from 'esbuild' ;
2
+
3
+ const mode = ( process . argv [ 2 ] ?? 'build' ) ;
4
+
5
+ const commonOptions = {
6
+ logLevel : 'info' ,
7
+ bundle : true ,
8
+ target : 'es2021' ,
9
+ sourcemap : 'linked' ,
10
+ outdir : 'out/' ,
11
+ } ;
12
+
13
+ const extensionContext = await esbuild . context ( {
14
+ external : [ 'vscode' ] ,
15
+ format : 'cjs' ,
16
+ platform : 'node' ,
17
+ entryPoints : {
18
+ 'extension' : './src/extension.ts' ,
19
+ } ,
20
+ ...commonOptions
21
+ } ) ;
22
+
23
+ if ( mode === 'build' ) {
24
+ await extensionContext . rebuild ( ) ;
25
+ await extensionContext . dispose ( ) ;
26
+ } else if ( mode === 'watch' ) {
27
+ await extensionContext . watch ( ) ;
28
+ } else {
29
+ console . error ( `Usage: ${ process . argv0 } [build|watch]` ) ;
30
+ }
Original file line number Diff line number Diff line change 341
341
"lint" : " eslint --fix" ,
342
342
"tsc" : " tsc --project tsconfig.json" ,
343
343
"tsc:watch" : " npm run tsc -- --watch" ,
344
- "esbuild" : " esbuild ./src/extension.ts --bundle --sourcemap --outdir=out/ --format=cjs --platform=node --external:vscode " ,
345
- "esbuild:watch" : " npm run esbuild -- -- watch" ,
344
+ "esbuild" : " node build.mjs build " ,
345
+ "esbuild:watch" : " node build.mjs watch" ,
346
346
"vscode:prepublish" : " npm run lint && npm run tsc && npm run esbuild" ,
347
347
"package" : " vsce package"
348
348
},
You can’t perform that action at this time.
0 commit comments