Vite Not Reflecting File Changes Without Cache Clear in Bagisto – How to Fix in Dev?
-
Hi Team,
I'm working on a custom Bagisto theme using Vite for asset bundling. The setup works fine, but I'm facing an issue during development:
Every time I make a change to my CSS/JS or Blade files, I have to manually clear the cache to see the updates.
Here’s a summary of my setup:
Using laravel-vite-plugin in Bagisto (inside a custom theme)
.env is set to:APP_ENV=local APP_DEBUG=true
I’m running npm run dev during development
Can anyone guide me how to fix this properly for development so changes reflect instantly without clearing cache every time?
Any tips or best practices would be greatly appreciated.Thanks in advance!
-
Hello @arunchahar
Whenever any changes are made, it's important to recompile the assets.
To do this, you need to run either npm run build or npm run dev.Warm Regards
Team Bagisto -
This post is deleted! -
@Rishabh-Webkul I am already using npm run dev and also tried npm run build, but new changes don't show until I run php artisan cache:clear. Do I need to clear the cache every time? Is there any way to avoid this during development?
-
@arunchahar said in Vite Not Reflecting File Changes Without Cache Clear in Bagisto – How to Fix in Dev?:
I am already using npm run dev and also tried npm run build, but new changes don't show until I run php artisan cache:clear. Do I need to clear the cache every time? Is there any way to avoid this during development?
After Making any changes in the file you need to clear the Cache.
Regards
-
Hi @arunchahar,
It looks like you're encountering a response cache issue. To solve this during development, try disabling response cache in your .env file:
RESPONSE_CACHE_ENABLED=false
You should be able to see your changes reflected instantly without needing to clear the cache each time.