Thank you all for your invaluable assistance in resolving the issue with Vite build errors in my React project.
Following is what I did based on your suggestions:
1 - Moved index.html file from public directory to the main project's root directory.
2 - Updated the Vite config file for example like this
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
rollupOptions: {
input: 'index.html',
},
},
base: '/',
});
After implementing the said changes and running the build process, everything worked perfectly, and the build was successful. I greatly appreciate the detailed explanations and the reference to the Vite documentation, which clarified the correct handling of index.html and project structure.
Thank you NotFound & ooshp for your help and support!