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

Add include and middleware propery #50

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

Conversation

oscartbeaumont
Copy link

@oscartbeaumont oscartbeaumont commented Jan 17, 2024

include is the opposite of the existing exclude functionality.

middleware can run prior to parsing the request onto Vite and can return Response or undefined. undefined will pass the request onto Vite while a Response will be directly returned to the client.

This could be used for a manual Hono integration which could run any code to decide what to serve.

Copy link

changeset-bot bot commented Jan 17, 2024

⚠️ No Changeset found

Latest commit: f850a06

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mdluo
Copy link

mdluo commented Jan 20, 2024

The include rule will be really useful!

Sometimes I just need Hono to handle a few routes that don't have a common prefix, and leave all the rest to be handled by Vite dev server locally and served as static content on Cloudflare Pages. This is really tricky to achieve with only exclude rules.

@yusukebe looking forward to having this option!

@yusukebe
Copy link
Member

Hi @oscartbeaumont !

Sorry for the delay. This is awesome!

I think it can be factored, but I would like you to write tests first. This project has e2e tests, so please add the tests there.

https://github.com/honojs/vite-plugins/tree/main/packages/dev-server/e2e

Thanks!

@BierDav
Copy link

BierDav commented Jun 10, 2024

Are there any updates for this pr to get merged?

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.

4 participants