histoire-dev / histoire-dev/histoire

Hidden directories cause over-watching (node_modules watched) in dev

Open
#847 0 comments 0 reactions 0 assignees View on GitHub
to triage
Dominant language
TypeScript
Stars
3.6k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Expected behavior: Histoire excludes `node_modules` regardless of whether the project path contains a hidden directory.

Actual behavior: Histoire watches thousands of directories below `node_modules` and exits with `EMFILE` if path contains a hidden segment.

Most AI tools store their worktrees in a hidden directory by default, causing this issue transitively (only when in a worktree, fine on main checkout)

----

The workaround is to just specify stories ignored instead of relying on the default.
```
// Histoire beta.1 otherwise traverses dependencies when the project root is hidden.
storyIgnored: [
'**/node_modules/**',
'**/dist/**',
`${rootPath}/node_modules/**`,
`${rootPath}/.nuxt/**`,
],
```

### Reproduction

https://github.com/costleya/histoire-emfile-repro-hidden

Repro has a description in the README. Basically just clone and run dev.

### System Info

```shell
System:
OS: macOS 26.5.2
CPU: (10) arm64 Apple M4
Memory: 98.02 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.18.0 - /Users/costleya/.nvm/versions/node/v24.18.0/bin/node
npm: 11.16.0 - /Users/costleya/.nvm/versions/node/v24.18.0/bin/npm
pnpm: 11.15.1 - /opt/homebrew/bin/pnpm
bun: 1.3.14 - /opt/homebrew/bin/bun
Browsers:
Chrome: 150.0.7871.186
Safari: 26.5.2
```

### Used Package Manager

npm

### Validations

- [x] Follow our [Code of Conduct](https://github.com/histoire-dev/histoire/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [Contributing Guidelines](https://github.com/histoire-dev/histoire/blob/main/CONTRIBUTING.md).
- [x] Read the [docs](https://histoire.dev/guide/).
- [x] Check that there isn't [already an issue](https://github.com/histoire-dev/histoire/issues) that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/histoire-dev/histoire/discussions).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Contributor guide

Open the contributing guide

Research direction

Start with the linked histoire-emfile-repro-hidden README and run its dev command to reproduce the EMFILE failure. Compare behavior when the project path contains a hidden directory with the listed storyIgnored workaround; done means node_modules is excluded in both cases without traversing thousands of dependency directories.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.