Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Laravel cannot find a Sass or JS entry in the Vite manifest

ErrorUnable to locate file in Vite manifest: resources/sass/app.scss

Short answer

The @vite directive asks the built manifest for a file, and that file is listed only if it is an entry in the laravel() input option and the assets were built after adding it. Make the path in @vite and in vite.config identical, then run npm run build, or keep npm run dev running while you work.

  • Applies to Laravel 12, laravel-vite-plugin, Vite 7, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Put the two lists side by side: the paths in @vite in your Blade layout and the input option in vite.config.js. Every path in @vite must also be in input.

    grep -rn "@vite" resources/views
    grep -n "input" -A4 vite.config.js
  2. 2Match what you see, then jump to its fix

    1. 1The path in the message is missing from vite.config.js input@vite names a file that is not in the input listFix
    2. 2input is correct but the built manifest under public/build has no entry for the fileThe assets were built before the entry was added, or never builtFix
    3. 3The missing path is under resources/images or resources/fonts, used with Vite::asset()A static image or font is referenced but never passed through ViteFix

What does the error look like?

  • Unable to locate file in Vite manifest: resources/sass/app.scss

Cause 1 of 3

@vite names a file that is not in the input list

1Check

The Laravel plugin requires you to list the entry points of the application there, and they can be JS, CSS or preprocessed files such as Sass. The manifest contains the entries that were built, so anything else is not found.

grep -n "input" -A4 vite.config.js
grep -rn "@vite" resources/views

2Fix

Add the file to input, or change @vite to a file that is listed. Make the strings match exactly.

// vite.config.js
laravel({
    input: ['resources/sass/app.scss', 'resources/js/app.js'],
    refresh: true,
})
{{-- layout --}}
@vite(['resources/sass/app.scss', 'resources/js/app.js'])

3Verify

Build, then load the page.

npm run build

Confirmed by laravel.com

Did this fix it?

Cause 2 of 3

The assets were built before the entry was added, or never built

1Check

Production uses the manifest from the last npm run build. Changing vite.config.js does not update it by itself.

grep -n "app.scss" public/build/manifest.json

2Fix

Rebuild for production, or run the dev server while you develop so Laravel does not use the manifest.

npm run build
# while developing
npm run dev

3Verify

The manifest now lists the file.

grep -n "app.scss" public/build/manifest.json

Confirmed by laravel.com

Did this fix it?

Cause 3 of 3

A static image or font is referenced but never passed through Vite

1Check

Static assets are processed by Vite when running npm run build, and Vite::asset() returns the versioned URL of those. A file that your JavaScript never imports is not in the manifest.

grep -rn "Vite::asset" resources/views

2Fix

Import the folder in app.js with import.meta.glob so Vite processes the files, then build again.

// resources/js/app.js
import.meta.glob([
  '../images/**',
  '../fonts/**',
]);

3Verify

Rebuild; the file appears in the manifest.

npm run build
grep -rn "images" public/build --include=*.json

Confirmed by laravel.com

Did this fix it?

How do I stop it coming back?

  • Define the entry list once and copy it to @vite when you add a file.
  • Build assets in the deploy pipeline and keep public/build out of the repository.
  • Run npm run build in CI so a missing entry fails before release.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

tsconfig rejects allowImportingTsExtensions

An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly

allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.