mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
look for plugins/modules in tns_modules folder not only in the app root + test
This commit is contained in:
@@ -58,8 +58,19 @@ export function getComponentModule(elementName: string, namespace: string, attri
|
||||
var moduleId = MODULES[elementName] || UI_PATH + elementName.toLowerCase();
|
||||
|
||||
try {
|
||||
if (types.isString(namespace)) {
|
||||
var pathInsideTNSModules = fs.path.join(fs.knownFolders.currentApp().path, "tns_modules", namespace);
|
||||
|
||||
if (fs.Folder.exists(pathInsideTNSModules)) {
|
||||
moduleId = pathInsideTNSModules;
|
||||
} else {
|
||||
// We expect module at root level in the app.
|
||||
moduleId = fs.path.join(fs.knownFolders.currentApp().path, namespace);
|
||||
}
|
||||
}
|
||||
|
||||
// Require module by module id.
|
||||
instanceModule = require(types.isString(namespace) && fs.path.join(fs.knownFolders.currentApp().path, namespace) || moduleId);
|
||||
instanceModule = require(moduleId);
|
||||
|
||||
// Get the component type from module.
|
||||
var instanceType = instanceModule[elementName] || Object;
|
||||
|
||||
Reference in New Issue
Block a user