Search code examples
laravelsassvite

Unable to locate file in Vite manifest: resources/scss/hrms.scss. How to solve this using laravel vite?


I'm using laravel 9 and vite for building scss and js files. After running the npm run build command in production I'm getting the above error. Please help me to solve.

export default defineConfig({
    plugins: [
        laravel({
            input: ["resources/scss/app.scss", "resources/js/app.js"],
            refresh: true,
        }),
    ],
});

Solution

  • Please add the missing file resources/scss/hrms.scss in vite.config.js like below:

    import { defineConfig } from 'vite';
    import laravel from 'laravel-vite-plugin';
    
    export default defineConfig({
        plugins: [
            laravel({
                input: ["resources/scss/app.scss","resources/scss/hrms.scss", "resources/js/app.js"],
                refresh: true,
            }),
        ],
    });
    

    You can now use this file in the blade as

    @vite(['resources/scss/hrms.scss'])