analogjs/analog

Analog is great project, but the routing systems needs fixing

Closed this issue · 2 comments

Please provide the environment you discovered this bug in.

linux - x64

Which area/package is the issue in?

router

Description

Router in its current form is a little convoluted. Plus, like some other Issue created here, i have to kill the running ng serve and start again when creating a new route. But the main problem seems to be the router itself. Layout components are fine until they stop working. I have a simple app with some simple routes. But the trick is making it work, or not displaying an error at all. Analog keeps complaining about a component/route i no longer have in my code. And gives me no hint that there's an error in my codebase or in a specific component. Terminal is very silent about it, only on devtools i get to see any sort of hint about what's happening.

Please provide the exception or error you saw

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.

TypeError: Failed to fetch dynamically imported module: http://localhost:5173/src/app/pages/(layout).page.ts

Other information

image
image
image

I would be willing to submit a PR to fix this issue

  • Yes
  • No

It seems to be an error in vite cache. Probably you can solve this deleting the cache folder at node_modules/.vite for now

Thanks @vitusan. I'm looking at better ways to detect when to invalidate the cache when new page routes are added/deleted. I don't run into these issues when creating pages so its a bit harder to diagnose.

If you can provide a GitHub repo with reproducible steps that would be great because we have tests to validate nested route groups working.