there is something very basic that you must be doing wrong, there is no way it can fail if you have a public folder at the very root of your project, not under /src, the file is actually in there, and you refer to it with /file.ext. vite docs explicitely say that meta imports only work in some browsers, don’t work at all in ssr.
Never referenced in source code (e.g. robots.txt )
Must retain the exact same file name (without hashing)
…or you simply don’t want to have to import an asset first just to get its URL
Then you can place the asset in a special public directory under your project root. Assets in this directory will be served at root path / during dev, and copied to the root of the dist directory as-is.
The directory defaults to <root>/public , but can be configured via the publicDir option.
You should always reference public assets using root absolute path - for example, public/icon.png should be referenced in source code as /icon.png .