I am using React in this project with Vite.
I have two assets folders inside the Public folder
- Images
- Icons
When I run the build command vite build the dist includes the images and icons folders from the Puclic and it works fine.
Here is my vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
build: {
rollupOptions: {
output: {
assetFileNames: (assetInfo) => {
let extType = assetInfo.name.split('.')[1]
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
extType = 'img'
}
return `assets/${extType}/[name]-[hash][extname]`
},
},
},
},
})
But in Vercel when I depoly the page the Images and icons are not found 404.
In Vercel I can see that the Output Source shows a second assests file that I can't access instead of the images and icons folders.
Is this a problem in the build command in Vercel? or do I need to change the build options in vite.config.ts ?