build中一个路径计算的错误

This commit is contained in:
Xu Chang 2022-09-27 13:12:13 +08:00
parent 07c00f3b29
commit dfac402f87
2 changed files with 4 additions and 2 deletions

View File

@ -352,7 +352,8 @@ function analyzeEntity(filename, path, program, relativePath) {
*/
var moduleSpecifier = node.moduleSpecifier, importClause = node.importClause;
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(env_1.LIB_OAK_DOMAIN)) {
var moduleSpecifier2Text = relativePath ? path_1.default.join(relativePath, '..', moduleSpecifier.text) : path_1.default.join('..', moduleSpecifier.text);
// 编译后的路径默认要深一层
var moduleSpecifier2Text = relativePath ? path_1.default.join(relativePath, moduleSpecifier.text) : path_1.default.join('..', moduleSpecifier.text);
additionalImports.push(factory.updateImportDeclaration(node, undefined, undefined, importClause, factory.createStringLiteral(moduleSpecifier2Text), undefined));
}
}

View File

@ -512,7 +512,8 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
*/
const { moduleSpecifier, importClause } = node;
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(LIB_OAK_DOMAIN)) {
const moduleSpecifier2Text = relativePath ? PathLib.join(relativePath, '..', moduleSpecifier.text) : PathLib.join('..', moduleSpecifier.text);
// 编译后的路径默认要深一层
const moduleSpecifier2Text = relativePath ? PathLib.join(relativePath, moduleSpecifier.text) : PathLib.join('..', moduleSpecifier.text);
additionalImports.push(
factory.updateImportDeclaration(
node,