@@ -16,6 +16,7 @@ import {
16
16
convertDeepLinkConfigEntriesToString ,
17
17
getUpdatedAppNgModuleContentWithDeepLinkConfig ,
18
18
filterTypescriptFilesForDeepLinks ,
19
+ hasExistingDeepLinkConfig ,
19
20
isDeepLinkingFile ,
20
21
purgeDeepLinkDecorator
21
22
} from './deep-linking/util' ;
@@ -133,8 +134,11 @@ export function transpileWorker(context: BuildContext, workerConfig: TranspileWo
133
134
} ) ;
134
135
135
136
const file = context . fileCache . get ( getStringPropertyValue ( Constants . ENV_APP_NG_MODULE_PATH ) ) ;
136
- const deepLinkString = convertDeepLinkConfigEntriesToString ( getParsedDeepLinkConfig ( ) ) ;
137
- file . content = getUpdatedAppNgModuleContentWithDeepLinkConfig ( file . path , file . content , deepLinkString ) ;
137
+ const hasExisting = hasExistingDeepLinkConfig ( file . path , file . content ) ;
138
+ if ( ! hasExisting ) {
139
+ const deepLinkString = convertDeepLinkConfigEntriesToString ( getParsedDeepLinkConfig ( ) ) ;
140
+ file . content = getUpdatedAppNgModuleContentWithDeepLinkConfig ( file . path , file . content , deepLinkString ) ;
141
+ }
138
142
}
139
143
140
144
const program = ts . createProgram ( tsFileNames , tsConfig . options , host , cachedProgram ) ;
@@ -399,7 +403,7 @@ export function transpileTsString(context: BuildContext, filePath: string, strin
399
403
export function transformSource ( filePath : string , input : string ) {
400
404
if ( isDeepLinkingFile ( filePath ) ) {
401
405
input = purgeDeepLinkDecorator ( input ) ;
402
- } else if ( filePath === getStringPropertyValue ( Constants . ENV_APP_NG_MODULE_PATH ) ) {
406
+ } else if ( filePath === getStringPropertyValue ( Constants . ENV_APP_NG_MODULE_PATH ) && ! hasExistingDeepLinkConfig ( filePath , input ) ) {
403
407
const deepLinkString = convertDeepLinkConfigEntriesToString ( getParsedDeepLinkConfig ( ) ) ;
404
408
input = getUpdatedAppNgModuleContentWithDeepLinkConfig ( filePath , input , deepLinkString ) ;
405
409
}
0 commit comments