Cannot GET /xxx.html when I try to load a HTML file using window.location.href in Vite

Viewed 15

I'm developing a project where I need a authentication system, I'm using firebase to for that.
I don't want the login form to appear if the user is already logged.
So I did it:

This code

It works just fine, but when I use: npm run build and npm run preview, the index.html file works properly, but when I try to go to the main.html page, I get a Cannot GET /main.html error.
I could use React and React-route to do that, but I can't, it is a work for college and I have to use plain JavaScript.
I'm allowed to use firebase and vite.
If I can't make it work I will give up of vite for now and use firebase only. What do you guys think?

Vite Folder structure
Error

0 Answers
Related