update ace-loader/src/resource-plugin.js.

Signed-off-by: 卡哥 <lizhouze@huawei.com>
This commit is contained in:
卡哥 2023-01-04 01:36:55 +00:00 committed by Gitee
parent 0f5cf42a9c
commit bb993991a2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -140,16 +140,7 @@ class ResourcePlugin {
});
compiler.hooks.watchRun.tap('i18n', (comp) => {
comp.removedFiles = comp.removedFiles || [];
if (comp.removedFiles.length > 0) {
comp.removedFiles.forEach(file => {
if (file.indexOf(process.env.projectPath) > -1) {
const buildFilePath = file.replace(process.env.projectPath, process.env.buildPath);
if (fs.existsSync(buildFilePath)) {
fs.unlinkSync(buildFilePath);
}
}
})
}
checkRemove(comp.removedFiles);
});
compiler.hooks.normalModuleFactory.tap('OtherEntryOptionPlugin', () => {
if (process.env.abilityType === 'testrunner') {
@ -188,6 +179,19 @@ class ResourcePlugin {
}
}
function checkRemove(removedFiles) {
if (removedFiles.length > 0) {
removedFiles.forEach(file => {
if (file.indexOf(process.env.projectPath) > -1) {
const buildFilePath = file.replace(process.env.projectPath, process.env.buildPath);
if (fs.existsSync(buildFilePath)) {
fs.unlinkSync(buildFilePath);
}
}
})
}
}
function copyManifest() {
copyFile(manifestFilePath, path.join(output, 'manifest.json'));
}