Adding a static file to `/public` folder requires rebuilding the production application
Describe the feature
The Nuxt 3 application I've made is managed by someone who has an access to the production bundle via FTP and tried adding a PDF file to the /public folder. They thought it would be accessible as soon as the file was added (with neither rebuilding the app nor restarting the Nuxt process). However, this wasn't the case. I also wasn't certain of the answer, and after a bit of digging into the bundle's code, there is a manifest listing these files.
This issue is more of a discussion on whether the /public folder could or should behave like a file system. Quoting @pi0's message:
We might do something for it like an optional flag to check fs even if manifest was not found.
Additional information
- [ ] Would you be willing to help implement this feature?
- [ ] Could this feature be implemented as a module?
Final checks
- [X] Read the contribution guide.
- [X] Check existing discussions and issues.
Upstream issue created:
- https://github.com/unjs/nitro/issues/992
Related: https://github.com/nuxt/nuxt/issues/15779#issuecomment-1397418353 and others
To leave a note for a centralized workaround: You can use server api endpoint + useStorage to add files at runtime. I'd advise against using fs because it is a node dependency. useStorage is more flexible.
Is there a workaround solution for this? There are a lot of issues that correlate to this. It would be a great help to post any workaround if exists.
Closing as underlying Nitro issues was closed.