I need an unimported image to be copied over into the .next/static/media directory, how do I do that
Unanswered
Siamese Crocodile posted this in #help-forum
Siamese CrocodileOP
I need another version of my website's logo to be copied over into the build of my static website. The reason I need it copied over is I am referencing it in my emails so I need the image to be displayed. How can I get an unused image in the public folder to be copied over to the build? Using next 13.4
5 Replies
@Siamese Crocodile I need another version of my website's logo to be copied over into the build of my static website. The reason I need it copied over is I am referencing it in my emails so I need the image to be displayed. How can I get an unused image in the public folder to be copied over to the build? Using next 13.4
i don't see why you need to do that though, if you put the image inside
public then it will be accessible at the path to the image, regardless of whether it's imported or notif you have
public/image.png, then you can always access it at /image.png whether or not you import it anywhereSiamese CrocodileOP
@joulev Hey Joulev, that is not the case when performing a build. Once built if an image isn't imported then it isn't included in the build and the build is what exists at runtime in the docker container, not the source public folder.
@Siamese Crocodile <@484037068239142956> Hey Joulev, that is not the case when performing a build. Once built if an image isn't imported then it isn't included in the build and the build is what exists at runtime in the docker container, not the source public folder.
oh i see what you mean, i've always assumed that the public directory is handled by the build process but it turns out it isn't. there are now a few ways to go:
* modify the docker configuration to copy the public directory over as well, before running
* import the image anyway,
the second way requires you to find a way to know the image url though because it won't be a nice url but something like this
* modify the docker configuration to copy the public directory over as well, before running
next start* import the image anyway,
import "./path/to/image.png";, even when you don't need itthe second way requires you to find a way to know the image url though because it won't be a nice url but something like this
/_next/static/media/image.79ffbedc.pngSiamese CrocodileOP
I ended up importing it into a component and hiding it so it never loads for the end-user, lol