Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dynamic file imports #2294

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

feat: dynamic file imports #2294

wants to merge 3 commits into from

Conversation

deer
Copy link
Contributor

@deer deer commented Jan 31, 2024

closes #1405
supersedes #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.

deer and others added 2 commits January 31, 2024 16:26
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
@deer
Copy link
Contributor Author

deer commented Jan 31, 2024

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.

@deer
Copy link
Contributor Author

deer commented Jan 31, 2024

@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).

@deer
Copy link
Contributor Author

deer commented Mar 10, 2024

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.

@iuioiua
Copy link
Collaborator

iuioiua commented Mar 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: use dynamic imports for routes
2 participants