Last 12 weeks · 18 commits
1 of 6 standards met
Since I already submitted one PR, why not another 😅 This is branched off of #339 so that would need to be merged first if it's accepted. Love how this plugin works, but just wanted to augment the scalability surface of Vercel-deployed Hono applications. Summary Add opt-in multi-function output support to via . Keep existing single-function behaviour (__hono + catch-all route) unchanged when is not provided. Reduce config verbosity by making optional with sensible defaults. What changed Added support in the Vercel adapter: name (required) entry (required) routes (optional) function (optional per-function overrides) Multi-function build behaviour: Emits one function per configured entry at .vercel/output/functions/.func/index.js Writes per-function and Merges generated routes into Default route generation: If routes is omitted, generates If dest is omitted in a route, defaults to Validation: Throws on duplicate function names in Docs: Added/updated Vercel section in for multi-function usage and default route behaviour Tests Added coverage in for: Multi-function output generation (foo.func, bar.func) Per-function config overrides over shared Default route generation when routes is omitted Duplicate function name validation Added fixture: Sample app Sample app repo here. You can see it live at https://vite-plugin-hono-multi-output-examp.vercel.app/api Backward compatibility No breaking changes intended. Existing users without vercel.functions continue to get: catch-all route to __hono in Verification run (pass) (pass) in multi-output-sample (pass)
Repository: honojs/vite-plugins. Description: Vite Plugins for Hono Stars: 263, Forks: 60. Primary language: TypeScript. Languages: TypeScript (99.8%), JavaScript (0.2%). Homepage: https://hono.dev Latest release: @hono/vite-build@1.9.3 (2w ago). Open PRs: 10, open issues: 27. Last activity: 2w ago. Community health: 25%. Top contributors: yusukebe, github-actions[bot], 3w36zj6, arisris, justblender, meck93, nakasyou, calebkish, berlysia, chadxz and others.
TypeScript
I've been running into some issues with the Vercel helpers being added to the build which causing body parsing to fail. There's a number of issues and discussions throughout the community that appear to be at least somewhat related. https://github.com/honojs/hono/issues/1256 https://github.com/vercel/next.js/discussions/81346 https://github.com/nktnet1/rt-stack/discussions/21#discussioncomment-14380642 https://github.com/vercel/turborepo/discussions/4631 The option is not user-configurable in the plugin, but this PR fixes it. Reproduction This basic reproduction showcases the issue with the body parsing timing out. https://github.com/josiahwiebe/vite-plugin-hono-vercel-reproduction Run this to see it failing: Response: Fixed Example Here's an example using a version of the package from this PR. Working cURL: Response: Some other issues addressed in this PR: build script fails with an empty directory updated types to reflect latest Vercel Build Output API
Included ViteDevServer for request environment to make something like possible in dev server