-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
hono/build
#3659
Comments
Quick response. Rather than AOT, it would be nice to have a build script or bundler that writes out an optimal application "file" that includes the |
I forgot, but we discussed this issue - creating a build script or bundler - in this project Issue or PR with @usualoma. |
I have seen And you as said, it currently depends on Function, so it won't work with Cloudflare workers, etc. |
I’ve also been considering a feature like this for Hono, and I agree with @yusukebe on incorporating a build script. I recall we previously discussed this topic while comparing the speeds of Hono and Elysia with AOT compilation. Rather than embedding this directly into the router, integrating it into something like Honox might be more effective. The code/logic is already modularized with nested routes, allowing us to implement a script that merges these routes into a single, optimized Hono app. This approach could enhance performance across different runtimes. The key question now is which specific optimizations we could include in the build script to maximize efficiency. Thoughts? |
Even if we choice to build, we need the logic of code generation for optimization, so we will work on new PreparedRouter({
preparedMatch: () => {
...
} // precompiled
}) It should be able to be utilized when build. |
I don't know if that's possible, but if we can make good use of Parcel's macros, the prepared router will seem to make sense. The macros also work with Vite etc. |
But, IMO, we don't have to implement the |
I'm also interested in this area, and it's worth considering if there is a good approach. I'm also interested in macros. The reasons I considered this with "honox" before are as follows.
It isn't easy to prepare for apps that don't use static routing (use variables). I think that apps that use variables are in the minority, but I think it's inevitable that there will be conditions that determine whether or not they can be applied. There are currently |
What do you think about anything other than routing? For example, define a schema for the incoming JSON. After building the app, an optimized JSON parser is written in the build script. The parsing is then much faster than normally using |
some initial ideas -
|
Haha, topics are getting bigger! But I have the most fun when we talk about these things. |
It is why elysia is fast. I want Hono to implement it. And my personal opinion, build-time building is better than run-time building. Outputting code can reduce build size. |
Yes, exactly (though I don't want to fight with Elysia). |
|
In the future it may depend external package such as TypeScript compiler API and babel. So I think it should be in hono/middleware or other repo, and create |
+1 |
I'm creating a new router named "PreparedRouter" using AOT.
This issue is a thread to solicit opinions on concerns.
The text was updated successfully, but these errors were encountered: