@@ -157,6 +157,26 @@ async function getWebviewConfig(mode, env, entry) {
157157async function getExtensionConfig ( target , mode , env ) {
158158 const basePath = path . join ( __dirname , 'src' ) ;
159159
160+ const entry = {
161+ extension : './src/extension.ts' ,
162+ } ;
163+ if ( target === 'webworker' ) {
164+ entry [ 'test/index' ] = './src/test/browser/index.ts' ;
165+ } else if ( target === 'node' ) {
166+ entry [ 'test/index' ] = './src/test/index.ts' ;
167+ }
168+
169+ // Determine if we're building tests and choose the appropriate TypeScript config
170+ const hasTestEntry = 'test/index' in entry ;
171+ let tsConfigFile ;
172+ if ( hasTestEntry ) {
173+ // When building tests, use a config that includes test files
174+ tsConfigFile = target === 'webworker' ? 'tsconfig.browser.json' : 'tsconfig.test.json' ;
175+ } else {
176+ // When building only extension, use standard configs
177+ tsConfigFile = target === 'webworker' ? 'tsconfig.browser.json' : 'tsconfig.json' ;
178+ }
179+
160180 /**
161181 * @type WebpackConfig['plugins'] | any
162182 */
@@ -168,7 +188,8 @@ async function getExtensionConfig(target, mode, env) {
168188 async : false ,
169189 formatter : 'basic' ,
170190 typescript : {
171- configFile : path . join ( __dirname , target === 'webworker' ? 'tsconfig.browser.json' : 'tsconfig.json' ) ,
191+ configFile : path . join ( __dirname , tsConfigFile ) ,
192+ mode : 'write-tsbuildinfo'
172193 } ,
173194 } ) ,
174195 new webpack . ContextReplacementPlugin ( / m o c h a / , / ^ $ / )
@@ -187,15 +208,6 @@ async function getExtensionConfig(target, mode, env) {
187208 } ) ) ;
188209 }
189210
190- const entry = {
191- extension : './src/extension.ts' ,
192- } ;
193- if ( target === 'webworker' ) {
194- entry [ 'test/index' ] = './src/test/browser/index.ts' ;
195- } else if ( target === 'node' ) {
196- entry [ 'test/index' ] = './src/test/index.ts' ;
197- }
198-
199211 return {
200212 name : `extension:${ target } ` ,
201213 entry,
0 commit comments