@@ -3090,14 +3090,16 @@ namespace ts {
3090
3090
3091
3091
const oldSettings = program && program . getCompilerOptions ( ) ;
3092
3092
const newSettings = hostCache . compilationSettings ( ) ;
3093
- const changesInCompilationSettingsAffectSyntax = oldSettings &&
3093
+ const shouldCreateNewSourceFiles = oldSettings &&
3094
3094
( oldSettings . target !== newSettings . target ||
3095
3095
oldSettings . module !== newSettings . module ||
3096
3096
oldSettings . moduleResolution !== newSettings . moduleResolution ||
3097
3097
oldSettings . noResolve !== newSettings . noResolve ||
3098
3098
oldSettings . jsx !== newSettings . jsx ||
3099
3099
oldSettings . allowJs !== newSettings . allowJs ||
3100
- oldSettings . disableSizeLimit !== oldSettings . disableSizeLimit ) ;
3100
+ oldSettings . disableSizeLimit !== oldSettings . disableSizeLimit ||
3101
+ oldSettings . baseUrl !== newSettings . baseUrl ||
3102
+ ! mapIsEqualTo ( oldSettings . paths , newSettings . paths ) ) ;
3101
3103
3102
3104
// Now create a new compiler
3103
3105
const compilerHost : CompilerHost = {
@@ -3149,7 +3151,7 @@ namespace ts {
3149
3151
const oldSourceFiles = program . getSourceFiles ( ) ;
3150
3152
const oldSettingsKey = documentRegistry . getKeyForCompilationSettings ( oldSettings ) ;
3151
3153
for ( const oldSourceFile of oldSourceFiles ) {
3152
- if ( ! newProgram . getSourceFile ( oldSourceFile . fileName ) || changesInCompilationSettingsAffectSyntax ) {
3154
+ if ( ! newProgram . getSourceFile ( oldSourceFile . fileName ) || shouldCreateNewSourceFiles ) {
3153
3155
documentRegistry . releaseDocumentWithKey ( oldSourceFile . path , oldSettingsKey ) ;
3154
3156
}
3155
3157
}
@@ -3183,7 +3185,7 @@ namespace ts {
3183
3185
// Check if the language version has changed since we last created a program; if they are the same,
3184
3186
// it is safe to reuse the sourceFiles; if not, then the shape of the AST can change, and the oldSourceFile
3185
3187
// can not be reused. we have to dump all syntax trees and create new ones.
3186
- if ( ! changesInCompilationSettingsAffectSyntax ) {
3188
+ if ( ! shouldCreateNewSourceFiles ) {
3187
3189
// Check if the old program had this file already
3188
3190
const oldSourceFile = program && program . getSourceFileByPath ( path ) ;
3189
3191
if ( oldSourceFile ) {
0 commit comments