fastify-vite
fastify-vite copied to clipboard
Allowing passing additional context to the html function in spa mode
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
Currently SPA mode doesn't allows to pass additional context to the render function.
Motivation
I have a case that I wan't to render some stuff on the html not related to the React app.
For example, render app version inside a meta tag.
Example
reply.html({
version: env.BUILD_VERSION
});
Use https://vitejs.dev/config/#using-environment-variables-in-config?
Will it work inside the HTML? (In my case, I need it to be dynamic depending on the domain the app got served from)
As long as it's prefixed with VITE_, it will be picked up by Vite automatically.
But this feature request is very much worthwhile, I'll look into it and circle back.