Add option to turn off `index.html` read in `onRequest` hook
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).
I created a project template, 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 devto 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
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
Would checking if index.html exists suffice?
Also what if you want to have multiple entry points (An MPA)? There could be multiple different index.html involved...
Would checking if
index.htmlexists suffice?
Yes. I will make a PR for that 👍
Also what if you want to have multiple entry points (An MPA)? There could be multiple different
index.htmlinvolved...
Yes, a different HTML will be returned on each entry point. Since I'm using Edge.js (template engine), I'm able to create only one index.edge and use in other views as a component.
I am incredibly swamped at work but will circle back on this over the weekend.