Browser does not reload when I save a Blade file under Vite
Saving a .blade.php file does not reload the browserShort answer
Vite only reloads the page for Blade files when the Laravel plugin's refresh option is on. Set refresh to true, or list your own paths if your views live outside the defaults. If edits are not seen at all, for example in WSL2, turn on watch polling in the Vite server settings.
Fix it fast
1Find out which cause you have
Confirm the dev server is the thing serving your page, then look at the laravel() block.
grep -n -A6 "laravel(" vite.config.js2Match what you see, then jump to its fix
- 1
No refresh line inside laravel({ ... })The refresh option is not setFix - 2
refresh is already true, but views in a custom folder (a module or package) do not trigger a reloadYour views are outside the watched pathsFix - 3
Even CSS edits are not picked up while the dev server runsThe file system does not report changes (WSL2, shared folders)Fix
- 1
What does the error look like?
Saving a .blade.php file does not reload the browserCSS and JavaScript hot update, but view changes need a manual refresh
Cause 1 of 3
The refresh option is not set
1Check
Full page reloads for server-rendered views are opt-in.
grep -n "refresh" vite.config.js2Fix
Add refresh: true. It watches app/Livewire, app/View/Components, lang, resources/views and routes while npm run dev runs.
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),3Verify
Restart the dev server, change a view and watch the browser reload.
npm run devConfirmed by laravel.com
Cause 2 of 3
Your views are outside the watched paths
1Check
Only the default directories are watched. Anything else must be listed.
ls resources/views modules 2>/dev/null2Fix
Pass your own list of paths. This replaces the defaults, so include the default ones you still need.
laravel({
input: ['resources/js/app.js'],
refresh: ['resources/views/**', 'modules/**/views/**'],
}),3Verify
Save a file in the custom folder and check the reload.
npm run devConfirmed by laravel.com
Cause 3 of 3
The file system does not report changes (WSL2, shared folders)
1Check
When the project sits on a file system that does not emit change events, Vite never sees the save.
pwd2Fix
Enable polling for the watcher. It uses more CPU, so use it only where needed.
export default defineConfig({
server: {
watch: {
usePolling: true,
},
},
// plugins: [...]
});3Verify
Restart the dev server and edit a file.
npm run devConfirmed by laravel.com
How do I stop it coming back?
- Add any custom view folder to the refresh list the day you create it.
- Keep refresh: true in the starter config of every Laravel project.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
- EZ EstimaterConstruction quoting and job tracking for contractors, on a Laravel and Firebase stack.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
Related fixes
Back end
Laravel says Vite manifest not found at public/build/manifest.json
Vite manifest not found at: /var/www/app/public/build/manifest.json
Laravel's @vite directive looks for a running dev server first, then for a built manifest file.
3 causes, each with a fixBack end
The AWS SDK in Node.js cannot find any credentials
Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
The AWS SDK walks a fixed credential chain: code, environment variables, the shared files in ~/.aws, then role sources such as ECS or EC2.
3 causes, each with a fixBack end
AWS SDK for JavaScript v3 cannot find credentials, even for DynamoDB Local
A DynamoDB client pointed at http://localhost:8000 fails with the same message
The SDK walked its default credential provider chain and found nothing.
3 causes, each with a fixBack end
AWS SDK says the security token included in the request is invalid
The security token included in the request is invalid
The call reached AWS but the credentials it carried were refused.
3 causes, each with a fixBack end
TypeError: Cannot convert object to primitive value in JavaScript
TypeError: Cannot convert object to primitive value
JavaScript turns an object into a string or number by calling Symbol.toPrimitive, then valueOf and toString.
2 causes, each with a fixBack end
Amazon Cognito says the user pool client does not exist
ResourceNotFoundException (HTTP status code 400) returned by InitiateAuth
Cognito looks the app client ID up inside the Region you call.
3 causes, each with a fix