Add option to use polling instead of filesystem events when watching for filesystem changes #2793
Labels
feature / enhancement
New feature or request
p2-nice-to-have
SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Describe the problem
Currently sveltekit uses
cheap-watch
to detect when files have changed while running the dev server (https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/dev/index.js#L76).cheap-watch
makes use offs.watch
, which uses a system-specific event callback when a file changes.Unfortunately, when listening for events on a network drive (such as when using docker with a mapped folder), no events are emitted when files are changed. Other similar tools have an option to use filesystem polling instead of event callbacks, such as chokidar: https://github.com/paulmillr/chokidar#performance:
Describe the proposed solution
I believe the most flexible solution would be to switch to a different filesystem watcher that supports polling as well as filesystem events (such as chokidar). Configuring the module could then be achieved through the svelte.config.js file and a link directly to the module's documentation can be added to the current documentation for configuring watch settings.
Alternatives considered
Another option could be to use a secondary module for polling the filesystem and have a config option in svelte.config.js to either use polling or filesystem events.
Importance
would make my life easier
Additional Information
The current use case for me is to enable developing in docker. Currently, filesystem watching doesn't work at all due to network shares not triggering filesystem events, so HMR does not work. Everything works when running locally so it's not a showstopper, but it would be nice to have support for dockerized development environments.
The text was updated successfully, but these errors were encountered: