Using vite-plugin-static-copy
in vite.config.js
#11553
Unanswered
orangecoloured
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a number of files that I need to copy into the
build
directory. Images, html files, scripts etc. They need to be accessible viasomeurl.com/bla-bla/file
. It's working. Files are being moved where needed. But I noticed that theoutput
directory has them two times: in theclient
and in theserver
folders.Is this normal? Can I make it copy them only once to
client
? Something like having the copy script only invite.config.client.js
?I can't have them in
static
folder, because some of the assets are being generated on build stage and most of them are being minified and optimised. Having them in static will make them simply being transferred without any processing.I noticed that there are two runs happening:
vite v5.0.10 building SSR bundle for production...
andvite v5.0.10 building for production...
. But theprocess.env
anddefineConfig
's parameters are identical on both runs. So there's no way to use any prop to conditionally add thevite-plugin-static-copy
script.UPDATE
After I deployed to Netlify I guess the whole issues got "fixed". There's no duplication. Seems to depend on the adapter. But still would be nice to be able to control the execution of scripts depending on the build stage.
Beta Was this translation helpful? Give feedback.
All reactions