Search code examples
javascriptdeploymentweb-deploymentgithub-pagesvercel

Javascript works on localhost, but it stops on deploy github pages or vercel


Can someone tell me why the javascript works on localhost, but when using github Pages or vercel, the javascript stops?

code on github:https://github.com/Marincor/Bx-Bank

Deploy githubpage: https://marincor.github.io/Bx-Bank/

Deploy on Vercel: https://bx-bank.vercel.app/

when I go to the dev tools source of the pages index.html and cadastro.html they don't have the JS folder that I have linked.

print of devTools chrome sourcers tab

print of github JS folder

print of the script src inside the html file

i don't know what to do, any tips?

for some reason, the home.html works the javascript file, just index.html and cadastro.html doesn't.


Solution

  • Format the path to your script file with a preceding ./ like you do with your css links:

    <script type="module" src="./Assets/JS/Index.js"></script>
    

    Edit: and be aware of casing:

    <script type="module" src="./Assets/JS/index.js"></script>