-
Notifications
You must be signed in to change notification settings - Fork 676
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
proposal: use dynamic imports for routes #1405
Comments
I'm not sure how it would allow us to get rid of the manifest. Would love to learn more as I'd like to get rid of it too if possible. |
I don't think this could eliminate - import * as $0 from "./routes/index.tsx";
- import * as $1 from "./routes/passthrough.tsx";
- import * as $$0 from "./islands/Counter.tsx";
- import * as $$1 from "./islands/Passthrough.tsx";
const manifest = {
routes: {
- "./routes/index.tsx": $0,
+ "./routes/index.tsx": () => import("./routes/index.tsx"),
- "./routes/passthrough.tsx": $1,
+ "./routes/passthrough.tsx": () => import("./routes/passthrough.tsx"),
},
islands: {
- "./islands/Counter.tsx": $$0,
+ "./islands/Counter.tsx": () => import("./islands/Counter.tsx"),
- "./islands/Passthrough.tsx": $$1,
+ "./islands/Passthrough.tsx": () => import("./islands/Passthrough.tsx"),
},
baseUrl: import.meta.url,
}; |
Ah, sorry for not responding sooner. Yes, after creating this issue, I realised I was wrong. Though, @lionel-rowe, your idea looks like it has potential! I'd happily look at a PR if you wanted to submit one. @marvinhagemeister, do you see any issues with the proposal? |
Another idea: - import * as $0 from "./routes/index.tsx";
- import * as $1 from "./routes/passthrough.tsx";
- import * as $$0 from "./islands/Counter.tsx";
- import * as $$1 from "./islands/Passthrough.tsx";
const manifest = {
routes: {
- "./routes/index.tsx": $0,
+ "./routes/index.tsx": await import("./routes/index.tsx"),
- "./routes/passthrough.tsx": $1,
+ "./routes/passthrough.tsx": await import("./routes/passthrough.tsx"),
},
islands: {
- "./islands/Counter.tsx": $$0,
+ "./islands/Counter.tsx": await import("./islands/Counter.tsx"),
- "./islands/Passthrough.tsx": $$1,
+ "./islands/Passthrough.tsx": await import("./islands/Passthrough.tsx"),
},
baseUrl: import.meta.url,
}; |
Actually, I have some time. I'll look into this. |
@iuioiua is there a reason the deferred |
Wouldn't it be a bit slower to do |
Closing, the upcoming Fresh 2 release uses dynamic glob imports. |
Deno Deploy now supports statically analyzable dynamic imports. This may remove, if not reduce, reliance on the
fresh.gen.ts
file.The text was updated successfully, but these errors were encountered: