-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Don't cache localhost imports (or give an option to turn it off) #15509
Comments
You can achieve that by specifying |
Yes that fixes some problems, but not all. First, that doesn't prevent Deno from caching, just forces it to ignore the cache. I don't actually want the increased cache size that comes from caching all imports that come through But on principle, I would argue I shouldn't have to pass a flag to get behavior that should be the default. It doesn't make any sense, IMO, for localhost imports to be cached. What happens if I forget the flag? Suddenly the file I'm importing could actually be serving up a pre-cached file from a separate project on the same machine that happens to have the same name and was imported earlier using the same |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
How can we un-stale this issue? |
I suggest to open a new issue with description of your use case. |
The reason Deno caches remote imports, in my understanding, is (a) so that subsequent runs will be faster, and (b) so that previously imported modules can be imported even offline. Caching can be done without causing problems because we assume the content delivered by the server is (mostly) not going to keep changing on us.
None of this is true when the "remote" is localhost. The content isn't actually remote, so the speedup is probably negligible. Localhost works fine offline. And, most importantly, the assumption that the content being served is not changing is often wrong (i.e. in an active development context, which is what localhost is normally used for).
There's plenty of precedent for treating localhost differently, for example, Chromium treats localhost as a secure context even over http.
I propose that the default behavior be for Deno to not cache imports from localhost. Possibly it would be worth adding a flag to force even localhost files to be cached as well, though I'm stumped to come up with a legitimate use case for that.
The text was updated successfully, but these errors were encountered: