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

Fix: TypeError: file.replace is not a function #5831

Closed

Conversation

purplecandy
Copy link

Fixes issue #3890 which happens while developing on Linux.

Chowkidar returns an instance of FSWatcher which may or may not produce a Stat object with change events instead of just a string. The issue is easily reproducible on Linux systems.

@squidfunk
Copy link
Owner

Thanks for the PR. This sounds like something that should be fixed upstream, or is it documented behavior? Have you checked the issue tracker of chokidar whether this is a known issue?

@purplecandy
Copy link
Author

There are no open issues related to it as it's not a bug. It is just that the underlying watch event implementation uses different utilities depending on the OS. The only thing I found related to it on chokidar was this

@squidfunk
Copy link
Owner

Thanks again! Okay, so after investigating, I can say with confidence that the problem is triggered by RxJS, and not Chokidar. If there's more than one argument that is passed to the handler, RxJS emits an array, otherwise the first argument. However, we can just use the resultSelector to always return the first argument. Fixed in and superseded by 26de756.

@squidfunk squidfunk closed this Sep 21, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants