Vite deployment and build error

I’m trying to build a website using vite as module bundler using vanilla javascript and with the help of anime.js library .
it works just fine when i run the command npm run dev,however when i tried deploying it using github pages the website came with only the html file .
i tried pranshing gh-pages with only the dist file and only use that but i got the same result .
also after i run npm run build i tried opening the indx.html file using live server but that didn’t work as well .
on gitgub pages I’m getting an error message that says : { Loading module from “” was blocked because of a disallowed MIME type (“text/html”) },
and warning that says : { Loading failed for the module with source “” }.

and on my local server with live server im getting two error messages ,the first is just like the one above and the second is : { The resource from “” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff) }.

am i missing something or is there’s something that i need to learn first before atempting to deploy a website ?
PS: this is my first time working with vite.

link to the project on github:

link to the result on github pages :

Not sure about github pages, but to run a front-end server on an empty server.
1 - vite build
2 - then target ./dist static files, create a file like “serve.js”

const static = require("node-static")
const file = new static.Server("./dist")
  .createServer(function (request, response) {
      .addListener("end", function () {
        file.serve(request, response)

3 - run it : node serve.js
It may helps

alright , i’ll try that , but i don’t know anyting about node js , so maybe i’ll start by learning a bit .
thanks for your help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.