-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refresh
config overwritten by server
#228
Comments
Let me know what further info I should provide and I'll gladly add it. |
@jeff-h waiting on Jess and Tim to confirm and triage. |
@jeff-h can you please set I was unable to replicate the issue with a fresh installation and the following configuration. Editing the views refreshed the page as expected. import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import fs from 'node:fs'
const host = 'vite-issue.test';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
server: {
host,
hmr: { host },
https: {
key: fs.readFileSync(`/Users/tim/.config/valet/Certificates/vite-issue.test.key`),
cert: fs.readFileSync(`/Users/tim/.config/valet/Certificates/vite-issue.test.crt`),
},
},
}); If you could provide a minimum reproduction repository for us that replicates the issue, we can look into this further. Thanks. |
I believe I have discovered the cause; in a completely clean Breeze & Blade site, if you add the following to import.meta.glob([
'../images/**',
'../fonts/**',
]);
If you add an exclusion (as per https://vitejs.dev/guide/features.html#negative-patterns) it exhibits the undesired behaviour. import.meta.glob([
'../images/**',
'../fonts/**',
'!**/bar.js',
]);
|
Edited. @jeff-h After investigation, I can confirm that it is not the Laravel plugin triggering the refresh, but Vite itself. You can see the issue on the Vite repo: vitejs/vite#13374 |
Thanks @timacdonald — really appreciate your time digging into this! |
No troubles at all. |
Vite Plugin Version
0.7.8
Laravel Version
10.9.0
Node Version
19.8.1
NPM Version
9.5.1
Operating System
macOS
OS Version
13.3.1
Web browser and version
Brave Version 1.51.114 Chromium: 113.0.5672.92 (Official Build) (arm64)
Running in Sail?
No
Description
I'm using Indigo which generates an SSL cert for my site. I've followed the instructions at Working With A Secure Development Server by adding a
server
section to my config, specifying the paths to my key and cert.This works fine, but appears to have an unintended consequence causing Vite to watch the entire project, not just the paths that it should.
Any time a file is added/deleted (but not when a file is changed) in any directory of the entire project, Vite triggers a reload. Amongst other issues, this caused an infinite reload when my project wrote to
storage/debugbar
.I can fix that specifically by adding a
watch
config inside the server section like so:but I'd much rather it just watch the proper paths.
Is this a one-off misconfiguration in my project, or is it a bug in how Vite-plugin merges its config?
My `vite.config.js`:
Steps To Reproduce
npm run dev
cp README.md DUMMY.md
The text was updated successfully, but these errors were encountered: