Getting SSG to work nicely
Hey everyone,
I'm facing an issue when trying to get SSG working. I am currently using Sanity and want to prerender all the routes to static html. I'm using vercel for production. This is my current setup:
app.config.ts
If i run a bun run build
it serves a good build that works locally, when i deploy to vercel that's where the issue lies. I get static pages working, but all styles are lost:
I'm using routes/work/slug.tsx
:
Not sure if I'm doing anything wrong or I'm missing something?
Also, I did try setting the preset in app.config.ts
to preset: 'static'
and static: true
worked nicely, but when it came to route navigation it would give me an error when visiting the page on route navigation. If i was to load the page directly, it would render fine.
P.S. Deploying to vercel can be extremely tricky too... any help will be appreciated 🙏
Thanks in advance!2 Replies
Seems like deployment issue and error looks similar to these, check if any of answers help you
https://stackoverflow.com/questions/2190459/the-stylesheet-was-not-loaded-because-its-mime-type-text-html-is-not-text-c
https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type/55100708
Stack Overflow
"The stylesheet was not loaded because its MIME type, "text/html" i...
I have a javascript application and when I run it on firefox I am getting the following erro on the console:
"The stylesheet was not loaded because
its MIME type, "text/html" is not
"text/css".
Stack Overflow
Stylesheet not loaded because of MIME type
I'm working on a website that uses Gulp.js to compile and browser sync to keep the browser synchronised with my changes.
The Gulp.js task compiles everything properly, but on the website, I'm unabl...
Yeah its definitely a deployment issue, i solved it in the end. Thank you!
I was getting a weird blank page, plus what i thought was failing was client route navigation. I am using Sanity and i forgot to allow CORS for both local and prod.
Here was my setup, incase anyone is curious for pure SSG:
A vercel gotcha which I ran into was we needed
compressPublicAssets: false
otherwise you would run into issues with filenames.