File tree Expand file tree Collapse file tree
packages/schematics/angular/migrations/use-application-builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -362,10 +362,16 @@ export default function (): Rule {
362362 ) ,
363363 // Update main tsconfig
364364 updateJsonFile ( 'tsconfig.json' , ( rootJson ) => {
365- rootJson . modify ( [ 'compilerOptions' , 'esModuleInterop' ] , true ) ;
365+ const module = rootJson . get ( [ 'compilerOptions' , 'module' ] ) ;
366+ const hasPreserveModule = typeof module === 'string' && module . toLowerCase ( ) === 'preserve' ;
367+
368+ if ( ! hasPreserveModule ) {
369+ rootJson . modify ( [ 'compilerOptions' , 'esModuleInterop' ] , true ) ;
370+ rootJson . modify ( [ 'compilerOptions' , 'moduleResolution' ] , 'bundler' ) ;
371+ }
372+
366373 rootJson . modify ( [ 'compilerOptions' , 'downlevelIteration' ] , undefined ) ;
367374 rootJson . modify ( [ 'compilerOptions' , 'allowSyntheticDefaultImports' ] , undefined ) ;
368- rootJson . modify ( [ 'compilerOptions' , 'moduleResolution' ] , 'bundler' ) ;
369375 } ) ,
370376 ] ) ;
371377}
You can’t perform that action at this time.
0 commit comments