Roots Discourse

Disable caching on development

I’ve had an issue for a while now and it acts differently on separate projects new and old where styles aren’t being injected. I have two terminal windows open in VSCode. One with browser sync watching and another where I can manually clear cache and build.

Lately I’ve had to run yarn cache clean and yarn build, then manually refresh my browser before seeing changes take place. Sometimes I have to do this a couple of times before I can see the changes. Meanwhile, I see the browser rebuilding and confirms webpack has rebuilt but even after a hard refresh the changes don’t appear. I have to go back and clear cache and rebuild manually, then hard refresh before my changes appear.

This also happens when I make changes to blade files but its even worse with those files. I have to clean cache, rebuild and hard refresh multiple times.

I really don’t know where to start looking to fix this issue. It’s so painfully time consuming to have to do this constantly. Hopefully someone here has an idea of what’s going on. I do truly appreciate any feedback!

Is anyone familiar with a way to setup the watch command to first clear cache, then build, then perform a hard refresh with Browsersync? Those are the steps I have to produce manually every time I make changes to my sass files.

yarn cache deals with the cache yarn keeps of your packages, so I really doubt that clearing it is actually having a direct effect on this issue. Usually when I’ve run into problems like this and I’ve determined that the issue isn’t in my per-theme configuration, the culprit usually has to do with filesystems. So far as I understand it, when yarn or whatever is watching your stuff for changes, it (ideally) depends on the filesystem & OS to report to it when files change, and then it executes some logic. Certain VM setups also have a similar issue if you have directories “synced” between the host and guest systems–the files are “watched” by your VM software and then changes are reported, but for various reasons that process can break down or be extremely slow. The fact that you’re seeing this (or similar) problems on several projects, and especially because you’re seeing it with your blades, makes me think that it’s very likely the issue is with your environment and its filesystem/reporting not working as it should.

1 Like