Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chokidar watch breaks on strange file/folder names #740

Closed
andy-shea opened this issue Mar 30, 2019 · 0 comments
Closed

Chokidar watch breaks on strange file/folder names #740

andy-shea opened this issue Mar 30, 2019 · 0 comments

Comments

@andy-shea
Copy link
Contributor

Bug Report

Describe the bug

The usage of chokidar to watch all files in the project (except for dotfiles and node_modules by default) can lead to issues if it encounters strangely defined file or folder names. This can be easily demonstrated when using docz in a laravel project due to it's dependency on the symfony/finder component which contains a test fixture folder named r+e.gex[c]a(r)s (see https://github.com/symfony/finder/tree/master/Tests/Fixtures).
(Note: this isn't fixed by simply setting the src config option as implied in #58 as the src directory is not used when configuring the files to watch for changes.)

While it would be easy, and more accurate, to shift blame to the chokidar lib, I feel like adding a config option to define a custom ignored watch paths regex would allow us to not only circumvent the issue for lot of cases but, and perhaps more importantly, will also allow us improve performance by ignoring directories that we know will have no bearing on docz and the components it utilises. There also doesn't seem to be much movement on that bug in their repo (paulmillr/chokidar#699).

To Reproduce

  1. Install laravel installer:
    composer global require laravel/installer
  2. Create a new laravel project:
    laravel new blog && cd blog
  3. Install JS deps:
    yarn add react react-dom && yarn add docz@next docz-theme-default@next --dev
  4. Add src config option to show that it's not relevant for this bug:
    echo "export default {src: './resources/js'}" >> doczrc.js
  5. Start the docz server:
    yarn docz dev
/private/tmp/laravel/blog/node_modules/snapdragon/lib/parser.js:473
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
        ^

Error: no parsers registered for: "]a(r)"
    at parse (/private/tmp/laravel/blog/node_modules/snapdragon/lib/parser.js:473:15)
    at Parser.parse (/private/tmp/laravel/blog/node_modules/snapdragon/lib/parser.js:477:24)
    at Snapdragon.parse (/private/tmp/laravel/blog/node_modules/snapdragon/index.js:122:28)
    at Snapdragon.<anonymous> (/private/tmp/laravel/blog/node_modules/braces/lib/braces.js:40:45)
    at Braces.parse (/private/tmp/laravel/blog/node_modules/braces/lib/braces.js:66:26)
    at Braces.expand (/private/tmp/laravel/blog/node_modules/braces/lib/braces.js:87:18)
    at create (/private/tmp/laravel/blog/node_modules/braces/index.js:142:15)
    at memoize (/private/tmp/laravel/blog/node_modules/braces/index.js:298:13)
    at Function.braces.create (/private/tmp/laravel/blog/node_modules/braces/index.js:165:10)
    at Function.braces.expand (/private/tmp/laravel/blog/node_modules/braces/index.js:81:17)
    at getDirParts (/private/tmp/laravel/blog/node_modules/chokidar/index.js:435:31)
    at FSWatcher.<anonymous> (/private/tmp/laravel/blog/node_modules/chokidar/index.js:452:24)
    at /private/tmp/laravel/blog/node_modules/readdirp/readdirp.js:220:72
    at Array.filter (<anonymous>)
    at /private/tmp/laravel/blog/node_modules/readdirp/readdirp.js:220:12
    at /private/tmp/laravel/blog/node_modules/readdirp/readdirp.js:193:38

See here for a repository I've prepared earlier: https://github.com/andy-shea/docz-chokidar-watch-bug

Expected behavior

Docz server should start without an error

Environment

  • OS: OSX 10.14.3
  • Node/npm version: Node 11.12.0/npm 6.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants