I have a problem with Angular 17 SSR app. On one particular page, I’m getting following error:
Failed to load module script: Expected a JavaScript module script but
the server responded with a MIME type of “text/html”. Strict MIME type
checking is enforced for module scripts per HTML spec.
-This error occurs when I build the project and push it on the server;
What’s specific about the page it occurs is the following:
Page route:
{
path: ':postID',
loadComponent: () => import('./pages/blog/dynamic-post-renderer-page/dynamic-post-renderer-page.component').then((m) => m.DynamicPostRendererPageComponent),
resolve: {
post: PostDataResolver
}
},
Before the page is loaded, it fetches the content and the page is being rendered after the content is fetched. Also, the path contains only the optional route param which is used to identify the post fetched from backend, and it is the last route in the file before the wildcard route;
-What is interesting is that this worked perfectly on server just before the last build was published, and nothing about this particular page or app.routes.ts was changed in the meanwhile.
Any idea on how to resolve this?