The issue seems to be with the Vite configuration. The laravel-vite-plugin is only watching the input files specified in the configuration. In this case, it is only watching resources/css/app.css and resources/js/app.js. To fix this, we need to add the output file generated by Tailwind to the input files.
Update the Vite configuration to include the output file generated by Tailwind:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'public/css/main.css'],
refresh: true,
}),
],
});
Here, we have added public/css/main.css to the input files. This is the file generated by Tailwind and contains all the styles. Now, when we run npm run watch or npm run dev, Vite will watch for changes in this file and rebuild the assets accordingly.
Note: Make sure that the path to the output file is correct. In this case, it is assumed that the output file is generated in the public/css directory. If it is generated in a different directory, update the path accordingly.