From 6d2eb39678fc59cb6e8b0cc2e62fc3ac9bf4fa19 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Mon, 28 Feb 2022 15:37:38 +0800 Subject: [PATCH] lizhouze@huawei.com Signed-off-by: lizhouze --- ace-loader/plugin/templater/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ace-loader/plugin/templater/index.js b/ace-loader/plugin/templater/index.js index 9fe1154..c69d342 100644 --- a/ace-loader/plugin/templater/index.js +++ b/ace-loader/plugin/templater/index.js @@ -28,10 +28,8 @@ const REGEXP_DATA = /^data-/ * @param {String} filePath File resource path. */ function parse(source, operate, filePath) { - const pathParse = path.parse(filePath) - let relativePath = pathParse.dir.replace(process.env.aceModuleRoot || - process.cwd(), '') + '/' + pathParse.base.replace(pathParse.ext, '') - relativePath = replaceAll(path.sep, '/', relativePath).replace('/', '') + const relativePath = replaceAll(path.sep, '/', path.relative( + process.env.aceModuleRoot || process.cwd(), filePath)).replace(path.parse(filePath).ext, ''); const result = { jsonTemplate: {}, deps: [], log: [] } compileResult = result const template = hmlParse(source, {