Vite Production Build: CSS/JS Not Loading - Need Assistance
I'm having trouble with my HTML, CSS, and JavaScript project using Vite. I'm building a Recipe Website with the MealDBAPI. The project works locally, but when I build it for production using npm run build and preview it, the CSS and JS files don't load, and I can't figure out why. I've tried many solutions but nothing has worked so far.
after I finished the website,I decided to build it for production, the css and js doesnt work anymore.
Here’s what I’ve done: - Moved all source files (HTML, CSS, JS) from the public directory to the src directory. - Updated all paths in the CSS and JS files, as well as image paths, from relative paths to root paths. - I tried to create console message to check if the API (mealDBAPI) is working but it working fine.
This is the error I am getting (but idk know if this is related to the problem I am facing): error
<div class="grid" id="recipe-container">
<div class="grid" id="recipe-container">
I checked recipe-container id and it exists in the displayRecipe.html where I want to render all the recipes but still getting this error. Though I am not sure if this error is the problem why mealDBAPI.js is not working
I’ve been stuck on this issue for days and would really appreciate any help to get this project working. Thank you so much!