!643 fix absolute path in sourcemap.

Merge pull request !643 from lihong/sourcemap
This commit is contained in:
openharmony_ci 2024-08-21 12:28:48 +00:00 committed by Gitee
commit 7ba8bc161e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -181,7 +181,10 @@ let config = {
filename: '[name].js',
pathinfo: false,
devtoolModuleFilenameTemplate: (info) => {
return `${info.absoluteResourcePath.replace(process.env.projectRootPath + path.sep, '')}`;
const newInfo = info.absoluteResourcePath.replace(process.env.projectRootPath + path.sep, '')
.replace(process.env.projectRootPath + path.sep, '')
.replace(path.join(__dirname, path.sep), '');
return newInfo;
},
globalObject: 'globalThis'
},
@ -405,7 +408,10 @@ module.exports = (env) => {
})],
});
config.output.devtoolModuleFilenameTemplate = (info) => {
return `${info.absoluteResourcePath.replace(process.env.projectRootPath + path.sep, '')}`;
const newInfo = info.absoluteResourcePath.replace(process.env.projectRootPath + path.sep, '')
.replace(process.env.projectRootPath + path.sep, '')
.replace(path.join(__dirname, path.sep), '');
return newInfo;
}
config.output.sourceMapFilename = '_releaseMap/[name].js.map'
}