Support for Versioning in Generated Output
We have apps that are client side only, served from S3, and I was thinking it would be nice if I could put everything generated into a
v-1.2.3/
folder, but keep index.html
in the root with the version released that points to this subfolder (favicon and robots would probably be a few that need to stay in the root). I can't seem to find a way to move everything but index. I suppose I could script it, but is there an easier way to make this happen?7 Replies
Hi @Brad Landis. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

----------------------
I'm sorry, but the knowledge sources do not contain explicit information about configuring Nuxt to output all generated files (except for specific ones like index.html, favicon, or robots.txt) into a versioned subfolder (e.g., v-1.2.3/) during a client-side only (static) build.
The documentation describes the .output/ directory, which is used for production builds, and the public/ directory for static assets that are served at the root and not modified by the build process. However, there is no mention of a built-in Nuxt configuration or option to customize the output directory structure in the way you described—specifically, to move all files except certain ones into a versioned subfolder automatically. The docs suggest that files in public/ are always served from the root, and there is no mention of output versioning or selective file placement in the generated output for static hosting scenarios. Scripting a post-build move appears to be the only option based on the available information .output directory public directory.
If you need this functionality, you may need to implement a custom script as you suggested, or look for third-party tools or plugins outside of the official documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1037541080633180192> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Why: Currently, if we update version 1.2.2 to 1.2.3, files will go missing, so users who load up 1.2.2 don't get style sheets or JS files, for example, so I want to keep old versions around for a period of time.
nuxt is customisable enough for you to write a module to do that
but it's not something that could be done out of the box
Ah, so probably just need to use a hook to put the files where I want (maybe
build:manifest
), and then link correctly (builder:watch
).