Skip to content

Commit 793f319

Browse files
committedAug 9, 2024··
fix(assets): copy nested files and directories when no wildcard #2687
1 parent 6ebb6e5 commit 793f319

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

Diff for: ‎lib/compiler/assets-manager.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,18 @@ export class AssetsManager {
103103

104104
this.watchers.push(watcher);
105105
} else {
106-
const files = sync(item.glob, { ignore: item.exclude }).filter(
107-
(matched) => statSync(matched).isFile(),
108-
);
106+
const matchedPaths = sync(item.glob, { ignore: item.exclude });
107+
const files = item.glob.endsWith('*')
108+
? matchedPaths.filter((matched) => statSync(matched).isFile())
109+
: matchedPaths.flatMap((matched) => {
110+
if (statSync(matched).isDirectory()) {
111+
return sync(`${matched}/**/*`, {
112+
ignore: item.exclude,
113+
}).filter((file) => statSync(file).isFile());
114+
}
115+
return matched;
116+
});
117+
109118
for (const path of files) {
110119
this.actionOnFile({ ...option, path, action: 'change' });
111120
}

0 commit comments

Comments
 (0)
Please sign in to comment.