Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github pages unable to find css with sveltekit

I have a github pages static website at norricorp.github.io/sveltekit. The root of the site is sveltekit. (I also have an unrelated website at norricorp.github.io). The site is built using sveltekit.

Entering the website, I get the following error in the console.

Loading module from “https://norricorp.github.io/sveltekit/_app/start-248e1695.js” was blocked because of a disallowed MIME type (“text/html”).

If I use the navigation (which does as expected) I get the following errors

GEThttps://norricorp.github.io/sveltekit/_app/assets/start-a8cd1609.css
[HTTP/2 404 Not Found 15ms]

more like this then

Loading module from “https://norricorp.github.io/sveltekit/_app/start-248e1695.js” was blocked because of a disallowed MIME type (“text/html”).   about

I suspect the problem lies in the svelte.config.js file

kit: {
        target: '#svelte',
        paths: {
            base: '/sveltekit',
            assets: '/sveltekit'
        },      
        adapter: adapter({
            pages: 'build',  // path to public directory
            assets: 'build',  // path to public directory
            fallback: null
        })
    }

Initially, paths was set ‘/’ or ‘./’ which caused navigation to use either norricorp.github.io/about(does not exist) or norricorp.github.io/sveltekit/about/about (same again). But navigation does now work with the above values but no formatting.

The generated index.html file is within the repo on the gh-pages branch.This looks correct.

<link rel="modulepreload" href="/sveltekit/_app/start-248e1695.js">
<link rel="modulepreload" href="/sveltekit/_app/chunks/vendor-111805ed.js">
<link rel="modulepreload" href="/sveltekit/_app/chunks/paths-45dac81d.js">
<link rel="modulepreload" href="/sveltekit/_app/pages/__layout.svelte-1d5e7523.js">
<link rel="modulepreload" href="/sveltekit/_app/pages/index.svelte-fdf5a78d.js">
<link rel="stylesheet" href="/sveltekit/_app/assets/start-a8cd1609.css">
<link rel="stylesheet" href="/sveltekit/_app/assets/pages/__layout.svelte-8ddef586.css">

I have cleared the browser cache. I have also created another github pages project under a different account so that it was a top level domain. Same result.

So the browser is looking in the right place, the files are there in the correct branch of the github repo but the browser is not finding them. Is github pages not serving these?

like image 382
John Avatar asked Oct 28 '25 04:10

John


1 Answers

I had deleted the .nojekyll file and forgot to replace it .....

like image 162
John Avatar answered Oct 30 '25 15:10

John



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!