I have a Rails 6 app with a very large chunk of vendor CSS and JS. The CSS and JS will rarely ever change. I want Rails to cache it.
I have created 2 packs. 1 contains all the imports from vendor and the other contains imports of my app's JS. I use javascript_packs_with_chunks_tag in the head for both.
Whenever I modify my app's JS file, that pack's cache is invalidated along with the vendor's pack as well!
This behaviour seems to be normal as I was able to reproduce it with a new Rails app.
Edit: I can fix the problem in a new Rails app by turning off compiling (webpacker.yml compile: false) and running webpack in a separate terminal tab (./bin/webpack --watch --colors --progress), but in my app I still experience the problem. It seems like there is some global variable or keyword that Webpack is finding that connects the two packs. Unfortunately the Webpack logs and dependency graph doesn't reveal that "connection". It's 100% not an import.