lukeed / sirv

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

File not refreshing #18

Closed jeremenichelli closed 6 years ago

jeremenichelli commented 6 years ago

Maybe I'm doing something wrong, but for some reason just running sirv with an index.html and a script file, I change my script file, refresh and the script does not update. I'm running v0.2.2, do I need a special flag? I guess I shouldn't since it's just a static need.

lukeed commented 6 years ago

Hey! You do need the --dev flag if you're using the CLI. It's opts.dev if you're using middleware.

Sirv assumes production mode by default, and in production you don't want to be constantly hitting the filesystem.

Hope that helps!

jeremenichelli commented 6 years ago

Oh cool. Should I open a PR with some warning o better flagging of this. It wasn't that obvious from the README, or maybe I was reading the wrong one 🤔

aubergene commented 6 years ago

I'm experiencing this issue too with sirv 0.2.2, I'm using the --dev flag. I came across the issue from using Svelte template. Tried in Firefox and Chrome.

lukeed commented 6 years ago

Is it possible you have any lingering cache headers or service workers running?

The dev mode for sirv maintains zero cache & traverses the filesystem every time a request reaches it. I'm thinking either of those two are fulfilling the request before it hits your server

aubergene commented 6 years ago

Wait, no I'm tired an misreading what --dev does, I thought it set up a watcher, but it's just that it sets params suitable for dev. Everything working as expected, sorry for the issue and thanks for the very quick response!

lukeed commented 6 years ago

No problem! My eyes often play tricks on me too