You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The image in public/public-images/public-image.png is copied to the dist folder
What is actually happening?
Nothing in the public folder is copied
I realize that when building a library, the default files in the public folder are not relevant and is okay behaviour in most cases.
However, for my case, I needed some images in the public folder as I didn't want their file names to be hashed. On the other hand, I didn't want to turn off file name hashing (as an option in vue.config.js) either.
I eventually solved this by tapping into the webpack config and copying over the public folder myself in there.
I don't think this is expected behaviour however as:
The documentation at https://cli.vuejs.org/guide/build-target does not mention anything about NOT copying the "public" folders content when running the build command with target -- lib
A github issue I found on inspecting the webpack config (trying to find how the CopyWebpackPlugin was configured for builds with target --lib), explicitly mentions there is no difference between building with or without target --lib apart from the entry and output options: Inspect should accept a --target #1250 (comment)
Version
4.4.1
Reproduction link
https://github.com/Robin-Hoodie/vue-target-lib-public-folder
Environment info
Steps to reproduce
yarn build --target libWhat is expected?
The image in
public/public-images/public-image.pngis copied to thedistfolderWhat is actually happening?
Nothing in the
publicfolder is copiedI realize that when building a library, the default files in the
publicfolder are not relevant and is okay behaviour in most cases.However, for my case, I needed some images in the public folder as I didn't want their file names to be hashed. On the other hand, I didn't want to turn off file name hashing (as an option in vue.config.js) either.
I eventually solved this by tapping into the webpack config and copying over the
publicfolder myself in there.I don't think this is expected behaviour however as:
buildcommand withtarget -- libtarget --lib), explicitly mentions there is no difference between building with or withouttarget --libapart from the entry and output options: Inspect should accept a --target #1250 (comment)