Vite doesn't resolve my Assets

Hi. I’m using vite as build tool and written a project in react/tailwind. when I run build command it shows me the error message below.

./src/assets/images/new/webp-format/architecturals-tablet.webp referenced in I:/Programing/Projects/Front-End Mentor Projects/Advanced/Photosnap/Photosnap/src/Styles/main.css didn't resolve at build time, it will remain unchanged to be resolved at runtime

I’ve included my images inside tailwind.config.cjs

You need to provide some more information if you want anyone to be able to help you. At least the line of CSS where the import is happening, and the file structure of the project (at least where the specific image and the CSS file are). Better would be a publicly visible repository, etc.

Yes, need some idea how you’ve set up your project: what does the config file look like, what the structure.

That being said, Vite doesn’t have any built-in ability to automatically copy static assets, so the error possibly is sensible (in that it can’t resolve those paths because the files don’t exist). This seems to have been tightened up sometime in November, there are a few issues on the repo where people are finding newer versions of Vite are doing something similar to what you’re seeing here. But again, can’t tell without more info – afaics, adding one of the many plugins that exist for handling static assets in dependencies is the common fix (for example)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.