mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
fix(builder): check for custom components registered at build time (#5834)
This commit is contained in:
@ -169,7 +169,8 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr
|
|||||||
|
|
||||||
let result: ComponentModule;
|
let result: ComponentModule;
|
||||||
componentPath = componentPath.replace("~/", "");
|
componentPath = componentPath.replace("~/", "");
|
||||||
const moduleName = componentPath + "/" + componentName;
|
const moduleName = `${componentPath}/${componentName}`;
|
||||||
|
const xmlModuleName = `${moduleName}.xml`;
|
||||||
|
|
||||||
let fullComponentPathFilePathWithoutExt = componentPath;
|
let fullComponentPathFilePathWithoutExt = componentPath;
|
||||||
|
|
||||||
@ -178,8 +179,7 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr
|
|||||||
}
|
}
|
||||||
|
|
||||||
const xmlFilePath = resolveFileName(fullComponentPathFilePathWithoutExt, "xml");
|
const xmlFilePath = resolveFileName(fullComponentPathFilePathWithoutExt, "xml");
|
||||||
|
if (xmlFilePath || global.moduleExists(xmlModuleName)) {
|
||||||
if (xmlFilePath) {
|
|
||||||
// Custom components with XML
|
// Custom components with XML
|
||||||
|
|
||||||
let subExports = context;
|
let subExports = context;
|
||||||
@ -202,7 +202,9 @@ function loadCustomComponent(componentPath: string, componentName?: string, attr
|
|||||||
|
|
||||||
subExports["_parentPage"] = parentPage;
|
subExports["_parentPage"] = parentPage;
|
||||||
|
|
||||||
result = loadInternal(xmlFilePath, subExports);
|
result = xmlFilePath ?
|
||||||
|
loadInternal(xmlFilePath, subExports) :
|
||||||
|
loadInternal(xmlFilePath, subExports, moduleName);
|
||||||
|
|
||||||
// Attributes will be transfered to the custom component
|
// Attributes will be transfered to the custom component
|
||||||
if (isDefined(result) && isDefined(result.component) && isDefined(attributes)) {
|
if (isDefined(result) && isDefined(result.component) && isDefined(attributes)) {
|
||||||
|
Reference in New Issue
Block a user