Issue with yarn run start after yarn build:production

I launched a site a few weeks ago using Sage9 and I’m having trouble with yarn run start now on my local env.

What seems to be happening is that the code is still trying to reference cache-busted resources (like images).

I tried running yarn run build to clear out the cache-busting set by production, but that doesn’t help (like I did in Sage8 with gulp).

Is there a place where the environment is set that I’m forgetting? Thanks!

Sounds like your remote server has the pages cached that references the old assets? You should try clearing cache during a deploy

Did you try yarn run rmdist ? I’m just starting with Sage 9 but it looks like that should clear your dist folder. The scripts are all listed in the package.json file.

You might also be able to simply delete the dist folder.

By the way, in Sage 8, I always had to run gulp clean and then gulp buildto go back to development mode after running the production flag…

@ben, I’m trying to do some css fixes on my local env before deploying. So I’m running into these issues on local. I tried deleting the .cache-loader folder. Is there another local cache or manifest that is referencing the files that were created in build:production?

@stephen, thanks for the response! Dist is deleted automatically each time build is run, so that’s not the issue here. It definitely was a bit more straightforward in Sage 8!

Try clearing your Blade templates cache? You can find that folder in the uploads directory in wp-content (or app for Bedrock setups)

@isabisa, you’re welcome and I’m sorry it wasn’t more helpful… It’s certainly a learning process with Sage but it beats dealing with the painful mess that is “traditional” WP development!

@ben: do you have any plans to make a command for clearing all the caches? In Laravel there’s the view:clear command and maybe there could be something similar for Sage to streamline situations like this. I think all the Roots projects are amazing and I’ve already learned a lot, so thanks to you and the rest of the team for being so generous with your work and knowledge! :slight_smile:


Good call, I just tried deleting that cache directory and had high hopes but it didn’t fix the issue. I’m digging around in the theme trying to find a manifest file so I can try to debug but don’t see one. Is there not one in Sage 9?

If you just delete the dist directory do the styles break? If not then something, somewhere is caching.

I’m curious to know what you see in your dist directory - are they the plain, hash-free file names?

Also, where are these outdated references coming from? The CSS / JS / HTML?

Any other caching plugins installed in WP?

Oh hell. I had a caching plugin activated. Sorry for the trouble everyone!


At least you know the caching plugin is working :wink:

No trouble - I learned some useful new things about Sage 9!

Hah, yes! Well to answer your questions in case anyone refers to this in the future, the files in dist were plain, hash-free file names and the outdated references were coming from the HTML, which were in cached PHP files in my uploads directory, put there by the plugin. Derp.

1 Like