Visitar URL original
`addPassthroughCopy` is unreliable and array filtering syntax fails · Issue #4408 · 11ty/buildawesome · GitHub
Skip to content

addPassthroughCopy is unreliable and array filtering syntax fails #4408

Open

Description

@slightlyoff

Operating system

linux, cros, wsl, etc.

Eleventy

3.1.x

Describe the bug

config.addPassthroughCopy() fails in multiple ways when trying to filter out a specific directory or pattern.

First, the extended options for recursive-copy generally fail. The filter: (p) => { ... } method often passes empty strings because 11ty passes absolute paths to copy, but internally recursive-copy tries to generate relative paths...which end up as "", which is what is then passed into the filter function. This obviously fails.

Next, the exclusion syntax fails when passing an array; e.g.:

config.addPassthroughCopy([
  "./dir/**/*.*",
  "!./dir/not_you/**/*.*",
]);

This is down to incorrect handling of Arrays (vs the documentation), wherein 11ty's UserConfig.js treats anything that isn't a string as an iterable using Object.entries(), which means we don't get the correct stacked behavior:

for (let [inputPath, outputPath] of Object.entries(fileOrDir)) {

The values that get returned from Object.entries() of an Array give you an integer index as the first value, rather than an inputPath, so the whole thing fails.

Lastly, and it's a minor thing, but there's no way to map only part of a directory glob to the root of a destination without flattening things in a really contorted way. At this point, I think it's fair to say that addPassthroughCopy() is, if not my nemesis, certainly a recurrent charachter in weekends lost to 11ty debugging and profiling. Feels like a subsystem that should be brought fully in-house and re-written.

Reproduction Source Code URL

No response

Screenshots

No response

Activity

  1. added a commit that references this issue on Nov 2, 2026
  2. zachleat commented on Nov 2, 2026

    @zachleat
    Member

    The larger task is tracking here #3360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions