-
-
Notifications
You must be signed in to change notification settings - Fork 199
Cloudflare caches my manifest js file (stuck at hash) #361
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
Comments
Hey @sfenne! Hmm. Indeed - this could be a bug. The has should be 100% based on the "content" of the file. In other words, if the content of Btw, this may already be fixed in the upcoming release of Encore, which is based on Webpack 4. But, it may not be - not sure yet :). |
Hello @sfenne Try to change filename hashing of your js-files from default .configureFilenames({
js: '[name].[hash:8].js',
}) |
I can confirm that adding configureFilenames() option like @vkryukov76 suggested solves this issue. First of all, my manifest finally got a new hash: Then I changed a line of js in one of my sub modules and recompiled webpack: As to @weaverryan question, I can confirm the content changed before but the hash didn't. Hence the custom URL to my assets (?v=X.X.XXX). The custom URLs made sure the client always fetched an uncached version of the assets. Thank you guys! |
Not sure that using That being said I also think there is something wrong with the chunk hashes in both the Webpack 3 and the Webpack 4 versions. First, with Webpack 3: Take the files from this gist for instance: https://gist.github.com/Lyrkan/347273f3d83878067d2bb9e16e9a14a2 Let's compile it a first time and look at the filenames:
Now if we comment the
Same filenames but only the However modifying the content of a single file works seems to work as intended, for instance if you put back the
Now with Webpack 4 and the single runtime chunk enabled The files are all the same apart from the Without any change:
After commenting the
After putting back the
All the files are different from the first test but only the |
Doesn't seem to be a problem anymore. Using https://gist.github.com/Lyrkan/dde6151705fc17fa9d39e4b8debd37a6 with no change:
After commenting out
After putting the addEntry back again and commenting out the
Feel free to re-open if you're still able to reproduce the issue. |
Uh oh!
There was an error while loading. Please reload this page.
Whenever a js file changes in my project, the hash changes, which intended.
However, the manifest JS file's hash never changes (stuck at hash d41d8cd9) and therefore gets cached in CloudFlare.
This results in lots of javascript errors till the CF cache is cleared manually.
As a temporary and ugly solution, I include the two main js files appending a random number
<script src="{{ asset('build/manifest.js') }}?v={{ version }}"></script>
<script src="{{ asset('build/app.js') }}?v={{ version }}"></script>
Is this a bug or am I missing something?
Thanks
The text was updated successfully, but these errors were encountered: