Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit c51ac93

Browse files
committed
fix(transpile): check for existing deep link config before using generated one
1 parent 11a000a commit c51ac93

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/transpile.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
399403
export 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

Comments
 (0)