Check the browser console for errors and make sure that npm run dev creates a file named "hot" in the public directory
No hot reload with new laravel vite
Hi. I started to use vite. After an hour of testing I got it working, that the files will be loaded. I use homestead so I had to set server ip in the vite.config.js:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
server: {
host: '192.168.56.56',
},
});
Now I have another problem. Everytime I change something in my css, the updates are not show in my browser. Also not, if i reload the page. I have to exit the 'npm run dev' process and start the process again. Is my setting with server correct? And what else do I have to do? Have anybody an idea? Thx.
It works now :) I found another similar problem with vite and homestead and saw the line with: usePolling: true,:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel([
'resources/css/app.css',
'resources/js/app.js',
]),
],
server: {
host: '192.168.56.56',
watch: {
usePolling: true,
},
},
});
If somebody else have the problem with a new installed laravel, maybe this helps. @sinnbeck thx for your support.
ps: And if you use also scss then do npm install --save-dev sass and you can use the file paths to your scss files in the @vite directive.
Please or to participate in this conversation.