@@ -62,9 +62,9 @@ export class Bundler {
62
62
/**
63
63
* Runs tsc command to build the source.
64
64
*/
65
- async #runTsc( ) {
65
+ async #runTsc( outDir : string ) {
66
66
try {
67
- await execa ( 'tsc' , [ ] , {
67
+ await execa ( 'tsc' , [ '--outDir' , outDir ] , {
68
68
cwd : this . #cwd,
69
69
preferLocal : true ,
70
70
localDir : this . #cwd,
@@ -161,7 +161,21 @@ export class Bundler {
161
161
/**
162
162
* Step 1: Parse config file to get the build output directory
163
163
*/
164
- const { config } = new ConfigParser ( this . #cwd, 'tsconfig.json' , this . #ts) . parse ( )
164
+ const { config, error } = new ConfigParser ( this . #cwd, 'tsconfig.json' , this . #ts) . parse ( )
165
+ if ( error ) {
166
+ const compilerHost = this . #ts. createCompilerHost ( { } )
167
+ this . #logger. logError ( this . #ts. formatDiagnosticsWithColorAndContext ( [ error ] , compilerHost ) )
168
+ return false
169
+ }
170
+
171
+ if ( config ! . errors . length ) {
172
+ const compilerHost = this . #ts. createCompilerHost ( { } )
173
+ this . #logger. logError (
174
+ this . #ts. formatDiagnosticsWithColorAndContext ( config ! . errors , compilerHost )
175
+ )
176
+ return false
177
+ }
178
+
165
179
if ( ! config ) {
166
180
return false
167
181
}
@@ -177,7 +191,7 @@ export class Bundler {
177
191
* Step 3: Build typescript source code
178
192
*/
179
193
this . #logger. info ( 'compiling typescript source' , { suffix : 'tsc' } )
180
- const buildCompleted = await this . #runTsc( )
194
+ const buildCompleted = await this . #runTsc( outDir )
181
195
await this . #copyFiles( [ 'ace.js' ] , outDir )
182
196
183
197
/**
0 commit comments