nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Adding a static file to `/public` folder requires rebuilding the production application

Open DamianGlowala opened this issue 3 years ago • 2 comments

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

DamianGlowala avatar Feb 24 '23 12:02 DamianGlowala

Upstream issue created:

  • https://github.com/unjs/nitro/issues/992

issue-up[bot] avatar Feb 24 '23 13:02 issue-up[bot]

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.

TheAlexLichter avatar Feb 24 '23 13:02 TheAlexLichter

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.

fahmifitu avatar Mar 30 '23 16:03 fahmifitu

Closing as underlying Nitro issues was closed.

TheAlexLichter avatar Feb 21 '24 09:02 TheAlexLichter