File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,25 +22,41 @@ const esbuildProblemMatcherPlugin = {
2222 } ,
2323} ;
2424
25+ /** @type {import('esbuild').BuildOptions } */
26+ const sharedOptions = {
27+ bundle : true ,
28+ minify : production ,
29+ sourcemap : ! production ,
30+ sourcesContent : false ,
31+ external : [ 'vscode' ] ,
32+ logLevel : 'silent' ,
33+ plugins : [ esbuildProblemMatcherPlugin ] ,
34+ } ;
35+
2536async function main ( ) {
26- const ctx = await esbuild . context ( {
37+ // Desktop (Node) build
38+ const nodeCtx = await esbuild . context ( {
39+ ...sharedOptions ,
2740 entryPoints : [ 'src/extension.ts' ] ,
28- bundle : true ,
2941 format : 'cjs' ,
30- minify : production ,
31- sourcemap : ! production ,
32- sourcesContent : false ,
3342 platform : 'node' ,
3443 outfile : 'dist/extension.js' ,
35- external : [ 'vscode' ] ,
36- logLevel : 'silent' ,
37- plugins : [ esbuildProblemMatcherPlugin ] ,
3844 } ) ;
45+
46+ // Web (browser) build
47+ const webCtx = await esbuild . context ( {
48+ ...sharedOptions ,
49+ entryPoints : [ 'src/extension.web.ts' ] ,
50+ format : 'cjs' ,
51+ platform : 'browser' ,
52+ outfile : 'dist/web/extension.js' ,
53+ } ) ;
54+
3955 if ( watch ) {
40- await ctx . watch ( ) ;
56+ await Promise . all ( [ nodeCtx . watch ( ) , webCtx . watch ( ) ] ) ;
4157 } else {
42- await ctx . rebuild ( ) ;
43- await ctx . dispose ( ) ;
58+ await Promise . all ( [ nodeCtx . rebuild ( ) , webCtx . rebuild ( ) ] ) ;
59+ await Promise . all ( [ nodeCtx . dispose ( ) , webCtx . dispose ( ) ] ) ;
4460 }
4561}
4662
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const config: Config = {
1818 'src/**/*.ts' ,
1919 '!src/types/**' ,
2020 '!src/extension.ts' ,
21+ '!src/extension.web.ts' ,
2122 '!src/__mocks__/**' ,
2223 '!src/__tests__/**' ,
2324 ] ,
Original file line number Diff line number Diff line change 5757 " vscode.git"
5858 ],
5959 "main" : " ./dist/extension.js" ,
60+ "browser" : " ./dist/web/extension.js" ,
6061 "contributes" : {
6162 "commands" : [
6263 {
Original file line number Diff line number Diff line change 1+ /// <reference lib="webworker" />
12import * as vscode from 'vscode' ;
23import type { CommitMessageProvider } from './types' ;
34
You can’t perform that action at this time.
0 commit comments