-
Notifications
You must be signed in to change notification settings - Fork 4
fingerpint support for requirejs #7
base: master
Are you sure you want to change the base?
Conversation
Well the issue here is that assetGroup.hash() is going to return the hash of the main file only. What we want is the hash of all the files combined. |
Try changing test/public/js/controllers/test.js, both tests fail:
Meaning that sum changed! In requirejs it seems that 'files' array is used by hash() function, but not for anything else. So it's up to developer to make it meaningful. From other side, I've tried creating hash() on compiled output, but it's too late, data-main attribute is already rendered to html. I've also tried to use furl from static-expiry (it builds cache with hashes in memory), pretty tricky, but still not functional - same problem - compiled output is not yet generated when static-expiry builds cache, upon rendering page. I've thought that making serial execution of AssetGroupProcessors, could solve the problem (it also would be quite convenient for production mode, so app is started in ready state), but appeared overcomplicated to me, opposite to the approach in the pull request. |
Hi Tug, Let me kindly bring it up. |
Hi Tug, Let me check if you have any plans about it? With last update today, it does not calculate hash twice, so it's a bit better. Thank you. |
Thanks for your contribution @avalez, it's greatly appreciated :) However I'm not convinced yet of the utility of this patch. The md5 hash is indeed correct because you specified the list of files manually in your config (through the I really think the way to go is to postprocess the output, just take the hash of the output file itself and modify its name by appending the hash of its content. Don't you think ? |
Ok, I agree, my approach is not correct. Doing postprocess seems right to me. But can you implement it please? I've not managed so far :) In any case this pull request might be closed. |
Yeah it's not so easy because there are many cases to handle. For instance in require.js without the includeLib option, the main file is the require.js library, the generated app.js file is just a dependency but it is the one we want to add the hash to. Then we need to update properties |
Note, it's not optimal:
Side note, I seem have to use requirejs, because of requirejs/almond/issues/99