Vite deployment and build error

Hi!
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 “https://3xo13.github.io/assets/index.1e6917f6.js” was blocked because of a disallowed MIME type (“text/html”) },
and warning that says : { Loading failed for the module with source “https://3xo13.github.io/assets/index.1e6917f6.js” }.

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 “http://127.0.0.1:5500/assets/index.da26ad8e.css” 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:
https://github.com/3xo13/alpha-limit

link to the result on github pages :
https://3xo13.github.io/alpha-limit/

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")
require("http")
  .createServer(function (request, response) {
    request
      .addListener("end", function () {
        file.serve(request, response)
      })
      .resume()
  })
  .listen(3000)

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.