@@ -16,6 +16,7 @@ import {
1616 convertDeepLinkConfigEntriesToString ,
1717 getUpdatedAppNgModuleContentWithDeepLinkConfig ,
1818 filterTypescriptFilesForDeepLinks ,
19+ hasExistingDeepLinkConfig ,
1920 isDeepLinkingFile ,
2021 purgeDeepLinkDecorator
2122} from './deep-linking/util' ;
@@ -133,8 +134,11 @@ export function transpileWorker(context: BuildContext, workerConfig: TranspileWo
133134 } ) ;
134135
135136 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+ }
138142 }
139143
140144 const program = ts . createProgram ( tsFileNames , tsConfig . options , host , cachedProgram ) ;
@@ -399,7 +403,7 @@ export function transpileTsString(context: BuildContext, filePath: string, strin
399403export function transformSource ( filePath : string , input : string ) {
400404 if ( isDeepLinkingFile ( filePath ) ) {
401405 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 ) ) {
403407 const deepLinkString = convertDeepLinkConfigEntriesToString ( getParsedDeepLinkConfig ( ) ) ;
404408 input = getUpdatedAppNgModuleContentWithDeepLinkConfig ( filePath , input , deepLinkString ) ;
405409 }
0 commit comments