Hello, I have a simple website developed using Next js. I’m using Cloudflare Pages to host the website.
In the preview deploys using
dev branch everything works well. But in the production deploy, using
main branch. The website is broken and there are console errors.
The console errors say
Refused to execute script from 'https://annakukla.com/_next/static/chunks/framework-e70c6273bfe3f237.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. And I see that in the production website JS files have this header
content-type: text/html; charset=utf-8 which is wrong since it’s a JS file.
Is this a bug with Pages? and if so how can I remedy it?
It looks like you hit a 404. When a 404 happens we will serve your 404.html file (or index.html file if no 404.html is found). This explains why you got a HTML mime type.
Actually no it wasn’t a 404. I changed where I deploy the website and there was a brief time where there was a 404 (this is when I think you tried to access the site).
I grew frustrated with this debugging this issue and moved my site to Vercel and it works there