Cannot watch specific dependencies in node_modules
See original GitHub issueDescribe the bug
The documentation for server.watch contains the following example:
server: {
watch: {
ignored: ['!**/node_modules/your-package-name/**']
}
},
This example does not work. It appears that the builtin **/node_modules/**
exclude causes chokidar to not even look in node_modules
despite the negation in the subdirectory.
It appears this was originally tested (see #5023 and #5239) with ignored: ['!**/node_modules/**']
. This does work, but in a real project will almost immediately result in Error: ENOSPC: System limit for number of file watchers reached
.
See https://github.com/paulmillr/chokidar/issues/1225. I played with various chokidar options but I couldn’t see a way to achieve this.
Reproduction
See chokidar issue.
System Info
System:
OS: Linux 5.4 Linux Mint 20.3 (Una)
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 4.20 GB / 15.56 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.15.1 - /usr/bin/node
npm: 8.1.1 - ~/npm/bin/npm
Browsers:
Chrome: 102.0.5005.61
Firefox: 101.0
npmPackages:
vite: ^2.9.12 => 2.9.12
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
NPM doesn't install module dependencies - Stack Overflow
I found out that two of the packages needed different versions of the dependency. I resolved the conflict, removed node_modules and after a...
Read more >How to fix npm dependency hell - Sylhare's blog
You can see that the sub dependency got resolved to a specific version which is then saved in the package-lock.json . Check what's...
Read more >package.json - npm Docs
You may want to check the npm registry to see if there's something by that ... Dependencies are specified in a simple object...
Read more >Understanding dependency management with Node Modules
Some packages like React require that only one version is installed and will throw an error if multiple versions are present. If you...
Read more >The node_modules problem - DEV Community
The node_modules folder is where your project dependencies are stored, ... but as a user I clearly see a problem and some lessons...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, that’s very helpful as a temporary workaround until chokidar provides an official recommendation of how to fix this properly.
To preempt anyone who tries to close this:
@bluwy good thought but alas no, swapping the order doesn’t help:
Chokidar still seems to ignore the whole of
node_modules
and doesn’t bother looking inside it.