fastify / fastify/fastify-vite

Add option to turn off `index.html` read in `onRequest` hook

Open
#192 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
1.1k
Forks
103
Avg merge
6h 54m
Merged PRs (30d)
7

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested

### 🚀 Feature Proposal

Hey people, thank you so much for this package, really helpful!

I'm trying to create an integration using this package + [Edge.js (template engine)](https://edgejs.dev/docs/introduction).

I created a [project template](https://github.com/jlenon7/vite-fastify), but I needed to change some things inside `node_modules/@fastify/vite` to get it working. I had to comment these lines:

https://github.com/fastify/fastify-vite/blob/169b718d3f306b922c5666f659d0a201dfd8c861/packages/fastify-vite/mode/development.js#L84-L96

> [!TIP]
> Project template: https://github.com/jlenon7/vite-fastify.
> After installing dependencies, use `npm run dev` to start it.

Since I'm using Edge.js for the template engine with multiple pages, I don't need the `index.html` entry point, instead I use `app.scss` and `app.js` as entry points as you can see inside my [`vite.config.js`](https://github.com/jlenon7/vite-fastify/blob/bf5df02006d82692e5d083a9135403a93b097be1/vite.config.js#L26-L29)

Is there an easier way to create this integration? I had the idea to expose an option when registering `@fastify/vite` to turn `index.html` loading off inside `onRequest` hook. I would be happy to send a PR if you guys agree with the idea!

### Motivation

_No response_

### Example

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.