Standalone application not load "public" folder
Answered
West African Lion posted this in #help-forum
West African LionOP
I want to build standalone application, wrap it to zip archive and publish to Github Packages (i am using Github Actions to achieve this).
But in "standalone" mode i dont have fonts, images and css. How to fix it? I see answers like "manual copy static folder to standalone folder", but i want automated approach.
But in "standalone" mode i dont have fonts, images and css. How to fix it? I see answers like "manual copy static folder to standalone folder", but i want automated approach.
Answered by riský
you need to manually copy the static assets, but this is pretty simple in gh actions and can be indeed automated
for example this is what i do: https://github.com/RiskyMH/EmailThing/blob/main/.github/workflows/build.yml#L58-L62
for example this is what i do: https://github.com/RiskyMH/EmailThing/blob/main/.github/workflows/build.yml#L58-L62
4 Replies
you need to manually copy the static assets, but this is pretty simple in gh actions and can be indeed automated
for example this is what i do: https://github.com/RiskyMH/EmailThing/blob/main/.github/workflows/build.yml#L58-L62
for example this is what i do: https://github.com/RiskyMH/EmailThing/blob/main/.github/workflows/build.yml#L58-L62
Answer
@West African Lion its because you may want to host the files in cdn or something more fancy, so its more of need to copy to public and let nextjs serve them
and you may want to add the [static tag header for caching](https://github.com/RiskyMH/EmailThing/blob/main/next.config.js#L36-L45)