Building w/relative paths in plain JS deploy

Hi,
I’m looking for some clarification when building a plain vanilla JS site. When building the site https://weschessleague.netlify.app I had relative links to my css files in a root directory css and links like href=“./css/style.css”. Once built the css files were giving a 404 error. Only once I moved css files to /public and changed linked to absolute /css/styles.css did they load. Also none of the javascript files where being included in the build. I was receiving no errors in the build logs. Only after I did a local build to /dist and did another deploy did the javascript start working. So I would like to know is it necessary to do a local build before deploying and how can I get my relative links to work. I should also note that none of these problems were present when I spun up a server using netlify dev.
Update - Apparently I was wrong even locally JS was not working until I linked and did a ntl build on my local machine. Do you always have to do a build before a ntl dev to ensure you have all the latest updates? I thought when you deployed your site or did a ntl dev that Netlify did a build on the fly of your current changes? Am I wrong.
*

You say you’re working with plain vanilla JS, but you also mention building the site and public/dist folders, and I can see your index.js file ends up as index-2fa360a9.js.

The behavior you’re talking about would normally be related to whatever site generator system you’re using, what is executing when you run npm run build?

Sorry for the late response. I’m using Vite. It’s the most curious thing. If I don’t run a ntl link from my local machine first I notice that none of my JS events are attached to my DOM elements. Like I had my script element in the <head> before DOM was built which I don’t. I was under the impression that if I setup my site from Netlify UI I just link my site to my Github account, do a push to main branch, and oila site should be up and working.

@Alan_Killian Have you performed the Vite build locally and confirmed what it results in?

Netlify isn’t performing any magic, so whatever you’re encountering is most likely to be the behaviour of Vite and you should reference their documentation.

When setting up your site in Netlify you do need to specify some basic build configuration.

To simulate the build on Netlify you can execute the same build command locally (e.g. npm run build), go into the output folder and then run npx serve.