{"record":{"id":"687d9e30ddac2039","repo":"laravel/framework","slug":"unable-to-locate-file-in-vite-manifest-file","errorCode":null,"errorMessage":"Unable to locate file in Vite manifest: {$file}.","messagePattern":"Unable to locate file in Vite manifest: (.+?)\\.","errorType":"exception","errorClass":"ViteException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Foundation/Vite.php","lineNumber":1042,"sourceCode":"            }\n        }\n\n        return $imports;\n    }\n\n    /**\n     * Get the chunk for the given entry point / asset.\n     *\n     * @param  array  $manifest\n     * @param  string  $file\n     * @return array\n     *\n     * @throws \\Illuminate\\Foundation\\ViteException\n     */\n    protected function chunk($manifest, $file)\n    {\n        if (! isset($manifest[$file])) {\n            throw new ViteException(\"Unable to locate file in Vite manifest: {$file}.\");\n        }\n\n        return $manifest[$file];\n    }\n\n    /**\n     * Get the nonce attribute for the prefetch script tags.\n     *\n     * @return \\Illuminate\\Support\\HtmlString\n     */\n    protected function nonceAttribute()\n    {\n        if ($this->cspNonce() === null) {\n            return new HtmlString('');\n        }\n\n        return new HtmlString(' nonce=\"'.$this->cspNonce().'\"');\n    }","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Foundation/Vite.php#L1024-L1060","documentation":"Vite::chunk() throws ViteException when the requested entry point or asset key does not exist in the parsed manifest (build/manifest.json or the configured hot/build directory). The manifest is produced by vite build; a missing key means the entry name passed to @vite() / Vite::asset() does not correspond to anything Vite emitted.","triggerScenarios":"Calling Vite::asset('resources/js/missing.js') or @vite(['resources/js/missing.js']) where the path string is not exactly a key in public/build/manifest.json. Also when the manifest is stale because a new build was not run, or the build directory config does not match where the manifest actually lives.","commonSituations":"Renamed or deleted an input file but did not rerun npm run build. Path casing or extension mismatch ('.js' vs '.ts' vs '.jsx'). Wrong VITE_BUILD_DIR / build_directory config for a multi-build setup. Deployed code without the compiled assets. Running dev (npm run dev) but VITE is not detecting the hot file.","solutions":["Run npm run build (or npm run dev) so the manifest reflects the current entry points.","Confirm the exact key by opening public/build/manifest.json and matching the string passed to @vite() byte-for-byte.","Verify the build directory: config('app.asset_url') and the 'build' arg to Vite match where the manifest is emitted.","On deploy, ensure the build step runs before code is live and that public/build is in the artifact."],"exampleFix":"// before\n@vite(['resources/js/app.jsx'])\n// but manifest only has 'resources/js/app.tsx'\n\n// after\n@vite(['resources/js/app.tsx'])","handlingStrategy":"validation","validationCode":"$manifest = json_decode(file_get_contents(public_path('build/manifest.json')), true);\n$entry = 'resources/js/app.tsx';\nif (! isset($manifest[$entry])) {\n    throw new RuntimeException(\"Entry {$entry} missing from manifest; rebuild assets.\");\n}\n@vite([$entry]);","typeGuard":"function entryExistsInManifest(string $entry, ?array $manifest = null): bool {\n    $manifest ??= json_decode(file_get_contents(public_path('build/manifest.json')), true) ?: [];\n    return isset($manifest[$entry]);\n}","tryCatchPattern":"use Illuminate\\Foundation\\ViteException;\n\ntry {\n    Vite::asset('resources/js/app.tsx');\n} catch (ViteException $e) {\n    // log and fall back to unbuilt source or abort build\n}","preventionTips":["Run npm run build in CI before artifact packaging.","Commit or otherwise ship public/build/manifest.json to production.","Keep entry paths consistent with the manifest keys (verify by opening the file).","Fail the build if any expected @vite() entry is absent from the manifest."],"tags":["vite","laravel","assets","manifest","frontend"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}