feat: dynamic file imports
closes https://github.com/denoland/fresh/issues/1405 supersedes https://github.com/denoland/fresh/pull/1893
Trying this one again, since it seems pretty cool. Sadly there seems to be an issue with tests/fixture_layouts on my computer. I'm getting sporadic errors like this:
deno run -A main.ts
error: Top-level await promise never resolved
"./routes/dynamic/[tenant]/index.tsx": await import(
^
at <anonymous> (file:///Users/reed/code/denoland/fresh/tests/fixture_layouts/fresh.gen.ts:26:44)
But changing the deno runtime via deno upgrade causes it to go away before returning. Sometimes clearing the cache also seems to help.
It's interesting that island in dynamic route test => ./tests/layouts_test.ts:163:6 consistently fails on windows and mac, and seems to be passing on linux.
@iuioiua, perhaps you want to close your old one and we can go from here? This time I've hit all the manifests via deno task manifests (which I don't think existed when you last tried this).
When I'm in fresh/tests/fixture_layouts and run deno run -A main.ts it always fails with:
error: Top-level await promise never resolved
"./routes/dynamic/[tenant]/index.tsx": await import(
^
at <anonymous> (file:///Users/reed/code/denoland/fresh/tests/fixture_layouts/fresh.gen.ts:26:44)
but when I run deno run -A dev.ts it always starts just fine.
Observation: when the ./routes/dynamic/[tenant]/index.tsx route is moved to be the first entry within the manifest.routes object, this issue does not occur. It seems we're encountering some race condition. Either way, I suspect this to be a fault of the runtime.