From b07178d328e9e053cce5c24f42fe9836f5cac64d Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Fri, 22 Oct 2021 19:35:11 +0800 Subject: [PATCH] houhaoyu@huawei.com Signed-off-by: houhaoyu Change-Id: I1050c27d600da447ea518b837c4dd9e4d140dab9 --- ace-loader/main.product.js | 8 ++++---- ace-loader/src/resource-plugin.js | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ace-loader/main.product.js b/ace-loader/main.product.js index 0a3bd3c..7cb9448 100644 --- a/ace-loader/main.product.js +++ b/ace-loader/main.product.js @@ -57,11 +57,11 @@ function loadEntryObj(projectPath, device_level, abilityType, manifestFilePath) if (!fs.existsSync(appJSPath)) { throw Error(red + 'ERROR: missing app.js' + reset).message; } - entryObj['./app'] = projectPath + '/app.js?entry'; + entryObj['./app'] = path.resolve(projectPath, './app.js?entry'); } break; default: - entryObj[`./${abilityType}`] = projectPath + `/${abilityType}.js?entry`; + entryObj[`./${abilityType}`] = path.resolve(projectPath + `./${abilityType}.js?entry`); break } return entryObj; @@ -83,9 +83,9 @@ function addPageEntryObj(manifest, projectPath) { if (isHml && isVisual) { throw Error(red + 'ERROR: ' + sourcePath + ' cannot both have hml && visual').message; } else if (isHml) { - entryObj['./' + element] = hmlPath + '?entry'; + entryObj['./' + element] = path.resolve(projectPath, './' + sourcePath + '.hml?entry'); } else if (isVisual) { - entryObj['./' + element] = visualPath + '?entry'; + entryObj['./' + element] = path.resolve(aceSuperVisualPath, './' + sourcePath + '.visual?entry'); } }) return entryObj; diff --git a/ace-loader/src/resource-plugin.js b/ace-loader/src/resource-plugin.js index 3a763e2..36f2a75 100644 --- a/ace-loader/src/resource-plugin.js +++ b/ace-loader/src/resource-plugin.js @@ -162,14 +162,15 @@ function addPageEntryObj() { const visualPath = path.join(aceSuperVisualPath, sourcePath + '.visual'); const isHml = fs.existsSync(hmlPath); const isVisual = fs.existsSync(visualPath); + const projectPath = process.env.projectPath; if (isHml && isVisual) { logWarn(this, [{ reason: 'ERROR: ' + sourcePath + ' cannot both have hml && visual', }]); } else if (isHml) { - entryObj['./' + element] = hmlPath + '?entry'; + entryObj['./' + element] = path.resolve(projectPath, './' + sourcePath + '.hml?entry'); } else if (isVisual) { - entryObj['./' + element] = visualPath + '?entry'; + entryObj['./' + element] = path.resolve(aceSuperVisualPath, './' + sourcePath + '.visual?entry'); } }); } -- Gitee