Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

longestdrive's avatar

Getting started with Vite

Hi Starting a playground project with Laravel 10 and dipping my toes in with Vite for the first time. I've installed Jetstream and had a successful build - all good but now have problems with 2 areas:

Q1. When I add a style to an element in a view the added style is not being reflected in the built css file. For example I have this component:

<x-button class="ml-4 !bg-blue !text-white">
                            Import
                        </x-button>

When I run npm run build I expected the build to now include the blue styles into the final CSS, it's not.

Q2. If I try and run npm run dev I hit a maximum number of file watchers reached (using homestead). I've increased the file watch within linux to 100,000 but limit still being reached. It fails trying to watch node_modules for changes. Is there a way to configure Vite to not watch node_modules?

Here's my vite config file:

import { defineConfig } from 'vite';
import laravel, { refreshPaths } from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: [
                ...refreshPaths,
                'app/Http/Livewire/**',
            ],
        }),
    ],
});

and here's the tailwind config:

const defaultTheme = require('tailwindcss/defaultTheme');

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './vendor/laravel/jetstream/**/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Figtree', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
};
0 likes
5 replies
Jester_'s avatar

Maybe you forgot to put tailwind directives in the app.css file?

@tailwind base;
@tailwind components;
@tailwind utilities;
Snapey's avatar
Snapey
Best Answer
Level 122

bg-blue is not a valid class ?

text-white is valid as you dont have different shades

1 like
longestdrive's avatar

@Snapey If there was a selfie of me doing a hands in face I'll share it! Yes - I did not use a valid class name and so not updated - THANK YOU.

longestdrive's avatar

Thanks to @snapey (as ever :) ) the inclusion of the correct classes in the build is resolved.

However I'm still exceeding the maximum number of watches if I use npm run dev - so any suggestions there gratefully received

Please or to participate in this conversation.