Netlify can't find a JavaScript file in my HTML page

I have a simple website, with the project structure as

(project)
     js
          format.js
     index.html
     style.css

with “js” as the project folder. In index.html, I made sure to specify:

<script type="text/javascript" src="js/format.js"></script>

On the test environment (I use ViteJS) it works fine. However, when I launched the website on Netlify, the JavaScript does not load because it somehow can’t find the file path. I don’t understand why- can anybody help?

@tetron432 While you have a simple website, using Vite does make it more complicated than it seems and you’ve probably not read the Vite documentation.

If you try running your Build command locally and then view the static output, you’ll almost certainly see exactly the same thing.

Read the Getting Started documentation for Vite:

Add type="module" to your script element.