Fails to load dynamic routes when opened directly (opening from the address bar, not redirecting to it via code)
rojvv opened this issue · comments
This is most probably related to the import maps.
TL;DR
A dynamic route is at /foo/bar
, and the import map entries like ./vendor/...
and ./src/...
lead to /foo/vendor/...
and /foo/src/...
which will then be 404, hence return text/html
, and not the wanted script.
I could only reproduce this in production build.
This is fixed in v2.1.3
@deckchairlabs Seems like the location is now fixed, but it is trying to load .tsx
instead of the production .js
. Should we reopen this? :)
Hi @roj1512 , could you post the generated importMaps?
The error
Uncaught (in promise) Error: Unsupported Content-Type "text/html; charset=utf-8" loading https://host:port/src/app.tsx imported from https://host:port/client.b3e5c79f.js. Modules must be served with a valid MIME type like application/javascript.
Ah interesting, so its when linking to a path with more than one segment in the pathname eg https://example.com/blog/post-1
Could you try putting <base href="/" />
in the <head>
element and see if that solves it?
Yes, that <base href="/" />
fixes it.