Skip to content

Commit

Permalink
fix: 修复多次监听同一文件夹重命名问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Oct 25, 2022
1 parent 570af17 commit 5ee331e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite-plugin-autogeneration-import-file",
"version": "2.1.1",
"version": "2.1.2",
"description": "vite 自动生成 引入文件插件 支持vite2 、vite3 支持配合`unplugin-vue-components`自动引入组件/指令",
"type": "module",
"main": "dist/index.cjs",
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,16 @@ function loadPathsPlugin(dirOptions: dirOptions) {
}
tmpRemovePaths = [];
} else {//不存在文件
let changeFiles: string[] = []
let changeFiles: string[] = [];
let delNumber = 0;
loadFiles[index].slice(0).forEach((val, k) => {
if (val.fileName.startsWith(fileName + '/') || val.fileName == fileName) {
const code = getCode(item.dir, val.fileName, item.toFile, item.name, item.codeTemplates);
code.forEach((codeItem) => {
str = str.replace(codeItem.value, '');
});
loadFiles[index].splice(k, 1);
loadFiles[index].splice(k-delNumber, 1);
delNumber++;
changeFiles.push(val.fileName)
}
})
Expand Down

0 comments on commit 5ee331e

Please sign in to comment.