-
-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Prerequisites
- I have written a descriptive issue title
- 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:
fastify-vite/packages/fastify-vite/mode/development.js
Lines 84 to 96 in 169b718
| const indexHtmlPath = join(config.vite.root, 'index.html') | |
| const indexHtml = await read(indexHtmlPath, 'utf8') | |
| const transformedHtml = await this.devServer.transformIndexHtml( | |
| req.url, | |
| indexHtml, | |
| ) | |
| // Set reply.html() function with latest version of index.html | |
| reply.html = await config.createHtmlFunction( | |
| transformedHtml, | |
| this.scope, | |
| config, | |
| ) |
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
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