open-wc / es-dev-server

MIT License
53 stars 6 forks source link

Expose watch-debounce field to config? #9

Open JudahGabriel opened 2 years ago

JudahGabriel commented 2 years ago

I see there's an internal --watch-debounce internal config field, defaults to 100ms, but this value is not configurable by users.

Can we make this value configurable?

I'm seeing an issue with many of my projects where I save a single .ts file, and web dev server in watch mode restarts multiple times. Investigating the issue, the problem comes down to Typescript takes longer than 100ms between changes when writing the source map files, resulting in multiple reloads:

image

In the above screenshot, notice there is a > 100ms delay between the change of index.html and the change of pwabuilder-sw.js.map.

If I could control the watch debounce time, it would make my edit->debug->test cycle much smoother.

Would you accept a pull request enabling this?

daKmoR commented 2 years ago

in @web/dev-server which is the successor of es-dev-server it's a small plugin you could "fork" in your config and change to whatever logic/value you need

https://github.com/modernweb-dev/web/blob/master/packages/dev-server/src/plugins/watchPlugin.ts

PS: es-dev-server will likely not get any feature releases so it's probably best to move to @web/dev-server if possible