-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use a hash in js filenames for all environments #271
Conversation
@mikeyhew Apparently, we can't use
webpack/webpack-dev-server#377 (comment) |
more than that, it will not work because of a conceptual problem: bin/webpack-dev-server (and bin/webpack) updates the manifest.json when the compilation is finished. If you refresh before the compilation is finished, rails uses the old manifest.json, which points to the old file names (old hashes). I guess rails handles this by waiting to render the script tag until the compilation of the requested file is done (?). I think the right way to go would be to set the headers for every file in public/packs to something like |
@gauravtiwari That's... interesting. I changed my app's config today to put a hash in the filename, just like in this PR, and it works really well. Although I just checked my That comment farther down by @SpaceK33z is pretty naive though. I have some remote assets that aren't stored on my local machine, and the browser saves a lot of bandwidth by caching them. It especially helps when you're tethering your phone and want to minimize data charges.
|
If that works, it would be a fine solution. |
@mikeyhew Btw, you have been using watcher or dev server in development? |
Sprockets doesn't include a hash in development either. Relies on cache controls. We should do the same. |
It actually does since Rails 4.2,, but it relies on cache controls. |
@gauravtiwari I'm using watcher. I tried using the dev server, to see if it would stop things from being cached, but I think it still had the same problem. |
Fixes #267