Skip to content

Prevent browser caching of javascript packs, using a hash in the filename #267

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

Closed
mikeyhew opened this issue Apr 18, 2017 · 5 comments
Closed

Comments

@mikeyhew
Copy link
Contributor

Chrome keeps running old versions of application.js, unless I disable the cache in developer tools. This doesn't happen with sprockets because it includes a hash of the file's contents in the filename, preventing chrome from loading the file from cache unless the hash is the same.

Can we add this feature to webpacker? How would you recommend it be implemented?

@ytbryan
Copy link
Contributor

ytbryan commented Apr 19, 2017

I guess you are referring to development mode.

Because the hash is already available during production. So we can just switch it on for development? cc @gauravtiwari

@gauravtiwari
Copy link
Member

@ytbryan Yeah, we can do that, although I never had this problem :) but makes sense to just follow what sprockets is doing so, it works for all cases 👍

@mikeyhew
Copy link
Contributor Author

@ytbryan @gauravtiwari That sounds good. Where is the config for this?

@mikeyhew
Copy link
Contributor Author

Never mind, I found it. See the above pull request. Are any tests needed?

@dhh
Copy link
Member

dhh commented Apr 20, 2017

Need to set the right cache-control headers like sprockets does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants