vite-plugins icon indicating copy to clipboard operation
vite-plugins copied to clipboard

Add `include` and `middleware` propery

Open oscartbeaumont opened this issue 1 year ago • 4 comments

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.

oscartbeaumont avatar Jan 17 '24 04:01 oscartbeaumont

⚠️ No Changeset found

Latest commit: f850a06f753ee9ad95c9ca293683621a63e11fe5

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

changeset-bot[bot] avatar Jan 17 '24 04:01 changeset-bot[bot]

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!

mdluo avatar Jan 20 '24 15:01 mdluo

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!

yusukebe avatar Jan 21 '24 13:01 yusukebe

Are there any updates for this pr to get merged?

BierDav avatar Jun 10 '24 12:06 BierDav