lukeed / sirv

An optimized middleware & CLI application for serving static files~!
MIT License
1.07k stars 58 forks source link

When static file changed to longer during run #151

Closed step135 closed 1 year ago

step135 commented 1 year ago

During the run of sirv, I am updating static files. But if the content is getting longer, the end is removed. It looks like that sirv wants to preserve the length of the string of files as it was when it started. I need to stop it and start it every time and it is enoying.

lukeed commented 1 year ago

It will if cache is enabled, yes, because it takes a snapshot at startup to avoid duplicate trips to file system.

If you’re updating a file without restarting server then you have to use options.dev=true

step135 commented 1 year ago

Thank you for explanation. I can't find anything about this behaviour and dev mode in documentation besides that it exists. I would advice to clarify it there for everyone. All the best!

lukeed commented 1 year ago

Enable "dev" mode, which disables/skips caching. Instead, sirv will traverse the file system on every request.