@@ -400,18 +400,22 @@ function createConfig(options, entry, format, writeMeta) {
400
400
const absMain = resolve ( options . cwd , getMain ( { options, entry, format } ) ) ;
401
401
const outputDir = dirname ( absMain ) ;
402
402
const outputEntryFileName = basename ( absMain ) ;
403
- let tsconfigPath ;
404
- let tsconfigOptions = { } ;
405
403
let ts ;
404
+ let tsconfigOptions = { } ;
406
405
if ( useTypescript ) {
407
- tsconfigPath = resolve (
406
+ const tsconfigPath = resolve (
408
407
options . tsconfig || resolve ( options . cwd , 'tsconfig.json' ) ,
409
408
) ;
410
409
ts = require ( resolveFrom . silent ( options . cwd , 'typescript' ) || 'typescript' ) ;
411
- const tsconfigJSON = ts . readConfigFile ( tsconfigPath , ts . sys . readFile )
412
- . config ;
413
- tsconfigOptions = ts . parseJsonConfigFileContent ( tsconfigJSON , ts . sys , './' )
414
- . options ;
410
+ if ( fs . existsSync ( tsconfigPath ) ) {
411
+ const tsconfigJSON = ts . readConfigFile ( tsconfigPath , ts . sys . readFile )
412
+ . config ;
413
+ tsconfigOptions = ts . parseJsonConfigFileContent (
414
+ tsconfigJSON ,
415
+ ts . sys ,
416
+ './' ,
417
+ ) . options ;
418
+ }
415
419
}
416
420
417
421
let config = {
@@ -513,7 +517,7 @@ function createConfig(options, entry, format, writeMeta) {
513
517
} ,
514
518
files : options . entries ,
515
519
} ,
516
- tsconfig : tsconfigPath ,
520
+ tsconfig : options . tsconfig ,
517
521
tsconfigOverride : {
518
522
compilerOptions : {
519
523
module : 'ESNext' ,
0 commit comments