mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-25 06:05:39 -04:00
add node_module path Signed-off-by: puyajun <puyajun@huawei.com>
This commit is contained in:
@@ -79,9 +79,9 @@ export default function processImport(node: ts.ImportDeclaration | ts.ImportEqua
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let fileResolvePath: string;
|
let fileResolvePath: string;
|
||||||
if (/^(\.|\.\.)\//.test(filePath)) {
|
if (/^(\.|\.\.)\//.test(filePath) && filePath.indexOf(NODE_MODULES) < 0) {
|
||||||
fileResolvePath = path.resolve(pagesDir, filePath);
|
fileResolvePath = path.resolve(pagesDir, filePath);
|
||||||
} else if (/^\//.test(filePath)) {
|
} else if (/^\//.test(filePath) && filePath.indexOf(NODE_MODULES) < 0) {
|
||||||
fileResolvePath = filePath;
|
fileResolvePath = filePath;
|
||||||
} else {
|
} else {
|
||||||
fileResolvePath = getFileResolvePath(fileResolvePath, pagesDir, filePath, projectConfig.projectPath);
|
fileResolvePath = getFileResolvePath(fileResolvePath, pagesDir, filePath, projectConfig.projectPath);
|
||||||
@@ -257,7 +257,7 @@ function hasCollection(node: ts.Identifier): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isModule(filePath: string): boolean {
|
function isModule(filePath: string): boolean {
|
||||||
return !/^(\.|\.\.)?\//.test(filePath);
|
return !/^(\.|\.\.)?\//.test(filePath) || filePath.indexOf(NODE_MODULES) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCustomComponent(node: ts.ClassDeclaration): boolean {
|
function isCustomComponent(node: ts.ClassDeclaration): boolean {
|
||||||
@@ -323,7 +323,11 @@ function getFileResolvePath(fileResolvePath: string, pagesDir: string, filePath:
|
|||||||
}
|
}
|
||||||
let curPageDir: string = pagesDir;
|
let curPageDir: string = pagesDir;
|
||||||
while (!fs.existsSync(fileResolvePath)) {
|
while (!fs.existsSync(fileResolvePath)) {
|
||||||
fileResolvePath = path.join(curPageDir, NODE_MODULES, filePath);
|
if (filePath.indexOf(NODE_MODULES) > -1) {
|
||||||
|
fileResolvePath = path.join(curPageDir, filePath);
|
||||||
|
} else {
|
||||||
|
fileResolvePath = path.join(curPageDir, NODE_MODULES, filePath);
|
||||||
|
}
|
||||||
if (fs.existsSync(fileResolvePath + EXTNAME_ETS)) {
|
if (fs.existsSync(fileResolvePath + EXTNAME_ETS)) {
|
||||||
fileResolvePath = fileResolvePath + EXTNAME_ETS;
|
fileResolvePath = fileResolvePath + EXTNAME_ETS;
|
||||||
} else if (isPackageJsonEntry(fileResolvePath)) {
|
} else if (isPackageJsonEntry(fileResolvePath)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user