From f671f778f348d3fd9dc8341046115eca0156905e Mon Sep 17 00:00:00 2001 From: Stanimira Vlaeva Date: Sat, 19 May 2018 11:41:36 +0300 Subject: [PATCH] fix(builder): check for custom components registered at build time (#5834) --- tns-core-modules/ui/builder/builder.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tns-core-modules/ui/builder/builder.ts b/tns-core-modules/ui/builder/builder.ts index 48fd11e5c..86efcb94a 100644 --- a/tns-core-modules/ui/builder/builder.ts +++ b/tns-core-modules/ui/builder/builder.ts @@ -169,7 +169,8 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr let result: ComponentModule; componentPath = componentPath.replace("~/", ""); - const moduleName = componentPath + "/" + componentName; + const moduleName = `${componentPath}/${componentName}`; + const xmlModuleName = `${moduleName}.xml`; let fullComponentPathFilePathWithoutExt = componentPath; @@ -178,8 +179,7 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr } const xmlFilePath = resolveFileName(fullComponentPathFilePathWithoutExt, "xml"); - - if (xmlFilePath) { + if (xmlFilePath || global.moduleExists(xmlModuleName)) { // Custom components with XML let subExports = context; @@ -202,7 +202,9 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr subExports["_parentPage"] = parentPage; - result = loadInternal(xmlFilePath, subExports); + result = xmlFilePath ? + loadInternal(xmlFilePath, subExports) : + loadInternal(xmlFilePath, subExports, moduleName); // Attributes will be transfered to the custom component if (isDefined(result) && isDefined(result.component) && isDefined(attributes)) {