@@ -141,12 +141,14 @@ export class Bundler {
141141 /**
142142 * Runs tsc command to build the source.
143143 */
144- async #runTsc( outDir : string ) : Promise < boolean > {
144+ async #runTsc( args : { outDir : string ; project ?: string } ) : Promise < boolean > {
145145 try {
146146 await run ( this . cwd , {
147147 stdio : 'inherit' ,
148148 script : 'tsc' ,
149- scriptArgs : [ '--outDir' , outDir ] ,
149+ scriptArgs : Object . entries ( args ) . flatMap ( ( [ key , value ] ) =>
150+ value ? [ `--${ key } ` , value ] : [ ]
151+ ) ,
150152 } )
151153 return true
152154 } catch {
@@ -211,13 +213,17 @@ export class Bundler {
211213 * @example
212214 * const success = await bundler.bundle(true, 'npm')
213215 */
214- async bundle ( stopOnError : boolean = true , client ?: SupportedPackageManager ) : Promise < boolean > {
216+ async bundle (
217+ stopOnError : boolean = true ,
218+ client ?: SupportedPackageManager ,
219+ options : { tsconfigPath ?: string } = { }
220+ ) : Promise < boolean > {
215221 this . packageManager = client ?? ( await this . #detectPackageManager( ) ) ?? 'npm'
216222
217223 /**
218224 * Step 1: Parse config file to get the build output directory
219225 */
220- const config = parseConfig ( this . cwd , this . #ts)
226+ const config = parseConfig ( this . cwd , this . #ts, options . tsconfigPath )
221227 if ( ! config ) {
222228 return false
223229 }
@@ -251,7 +257,10 @@ export class Bundler {
251257 * Step 5: Build typescript source code
252258 */
253259 this . ui . logger . info ( 'compiling typescript source' , { suffix : 'tsc' } )
254- const buildCompleted = await this . #runTsc( outDir )
260+ const buildCompleted = await this . #runTsc( {
261+ outDir,
262+ project : options . tsconfigPath ,
263+ } )
255264 await this . #createAceFile( outDir )
256265
257266 /**
0 commit comments