updateTemplate for server templates
I know that updateTemplates exists to update virtual modules added by addTemplate, is there something similar for addServerTemplate to update a virtual module on the server? I have a virtual module added by addServerTemplate and I want to be able to update it without triggering a full-reload. But the filter function in updateTemplates does not seem to include my server template and I don't know how to exclusively update it based on the documentation.
2 Replies
Hi @SIGSEGV. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the available documentation,
updateTemplates
is designed to regenerate templates added via addTemplate
(for Nuxt's virtual filesystem), and you can filter which templates to update using the filter
option. However, the documentation does not explicitly state that updateTemplates
works with server templates added via addServerTemplate
(for Nitro's virtual filesystem). In fact, your observation that the filter function does not include your server template aligns with the current documentation and examples, which only mention addTemplate
and not addServerTemplate
in the context of updateTemplates
usage Nuxt Kit Templates API.
The guides and API references consistently separate the use of addTemplate
(for client/runtime) and addServerTemplate
(for server/Nitro), and there is no mention of a dedicated update utility for server templates or a way to trigger a hot update for them without a full reload Nuxt Kit Templates API Module Author Guide.
Therefore, I'm sorry, but the knowledge sources do not provide information about a way to update or hot-reload server templates created with addServerTemplate
using updateTemplates
or a similar utility. If this is a critical need, you may want to follow Nuxt's issue tracker or discussions for future enhancements in this area.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@583980674571304960> Kapa.ai is still learning and improving, please let me know how I did by reacting below.