Skip to content

Commit

Permalink
chore: set onlyFiles glob option
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Oct 27, 2024
1 parent 0f46f81 commit 7045b41
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,11 @@ class CopyPlugin {

/** @type {GlobbyOptions & { objectMode: true }} */
const globOptions = {
...{ followSymbolicLinks: true },
followSymbolicLinks: true,
...(pattern.globOptions || {}),
...{ cwd: pattern.context, objectMode: true },
cwd: pattern.context,
objectMode: true,
onlyFiles: true,
};

// @ts-ignore
Expand Down Expand Up @@ -412,7 +414,9 @@ class CopyPlugin {
let globEntries;

try {
globEntries = await globby(glob, globOptions);
globEntries = globOptions.onlyDirectories
? []
: await globby(glob, globOptions);
} catch (error) {
compilation.errors.push(/** @type {WebpackError} */ (error));

Expand Down Expand Up @@ -448,11 +452,6 @@ class CopyPlugin {
* @returns {Promise<CopiedResult | undefined>}
*/
async (globEntry) => {
// Exclude directories
if (!globEntry.dirent.isFile()) {
return;
}

if (pattern.filter) {
let isFiltered;

Expand Down

0 comments on commit 7045b41

Please sign in to comment.