Vite manifest not found at: /css/custom.css/manifest.json. How to fix this issue?
The error message "Vite manifest not found at: /css/custom.css/manifest.json" indicates that Vite, a popular development server for modern web projects, is unable to locate the manifest file for the specified CSS file located at "/css/custom.css". Here are some steps you can take to fix this issue:
-
Check if the manifest file exists: The first step is to ensure that the manifest file actually exists in the specified location. You can check this by navigating to the "/css/custom.css" directory in your project and looking for a file named "manifest.json". If the file is missing, you will need to create it.
-
Create the manifest file: To create the manifest file, you can use a JSON editor or create a new file in your text editor and add the following content:
{
"manifest_version": 2,
"name": "My Custom CSS",
"version": "1.0.0",
"files": {
"custom.css": "/css/custom.css"
}
}
Make sure to replace "My Custom CSS" with the name of your CSS file and adjust the version number as needed. Save the file as "manifest.json" in the same directory as your CSS file.
- Configure Vite: If you are using Vite to serve your project, you may need to configure it to look for the manifest file in the correct location. You can do this by adding the following line to your Vite configuration file (usually located at "vite.config.js"):
{
// Other config options...
server: {
middlewareMode: true,
middleware: [
// Other middleware options...
'@vitejs/plugin-manifest/manifest',
{
baseContent: ['/css/custom.css/manifest.json'],
},
],
},
}
Make sure to replace "/css/custom.css/manifest.json" with the actual path to your manifest file. This configuration tells Vite to serve the manifest file along with your CSS file.
-
Restart the development server: After making these changes, restart your development server to ensure that the new manifest file is being served correctly. Once the server is up and running, you should no longer see the error message.
-
Test your application: Finally, test your application to ensure that the CSS file is being loaded correctly and that the manifest file is being served. You can check the browser console for any errors or warnings related to the CSS file or the manifest file. If everything is working correctly, you should see your custom CSS applied to your web page.