Refactoring code to implement ES6 Modules broke Github Pages (404)

Viewed 249

I was hosting a demo of a canvas game I'm working on and everything was working smoothly until I decided to separate my code into modules using ES6 module syntax. I use import statements like import canvas, { ctx } from "/canvas.js"; and export them with

export default canvas;
export { ctx };

When I run the program through local server, everything works perfectly, but when I try my link to my Github Pages live demo, all of the modules except for the main program <script type="module" src="main.js"></script> give me 404 errors. How do I fix this?

0 Answers
Related