Skip to content

Build: fast-glob ignore patterns fail in dot-prefixed directories (e.g., git worktrees) #75113

@adamsilverstein

Description

@adamsilverstein

Description

The npm run build command fails when the repository is located in a path containing
a dot-prefixed directory, such as .worktrees/ (commonly used for git worktrees).

Steps to Reproduce

  1. Create a git worktree in a dot-prefixed directory:
    mkdir .worktrees
    git worktree add .worktrees/my-feature my-branch
    cd .worktrees/my-feature
  2. Run npm install
  3. Run npm run build

Expected Behavior

Build completes successfully, with .native.js, .ios.js, and .android.js files
excluded from the web build.

Actual Behavior

Build fails with errors like:

Could not resolve "./styles.scss"
  packages/primitives/src/horizontal-rule/index.native.js:14:19

Root Cause

fast-glob's ignore patterns don't match files inside dot-prefixed directories by
default. The IGNORE_PATTERNS array includes **/*.native.*, but this pattern fails
to match when the absolute path contains .worktrees/.

Who is Impacted

  • Developers using git worktrees in dot-prefixed directories
  • CI/CD systems that clone repositories into dot-prefixed paths
  • Any workflow where the repository path contains a directory starting with .

Solution

Add dot: true to the fast-glob options in packages/wp-build/lib/build.mjs.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions