-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Version
4.5.12
Environment info
webpack@4.46.0
copy-webpack-plugin@6.4.1
Steps to reproduce
Create a monorepo with yarn workspaces, a vue app and another package that contains translations:
.
└── packages/
├── applications/
│ ├── app1/
│ │ ├── public
│ │ └── dist
│ ├── app2
│ └── ...
└── common/
├── translations/
│ └── locales/
│ ├── en-GB/
│ │ └── common.json
│ └── de-DE
├── ui
└── ...
Install the copywebpackplugin and configure your vue.config.js to copy locale files from the @namespace/translations
module to the /public
folder of the vue app.
module.exports = {
devServer: {
writeToDisk: true,
},
configureWebpack: {
plugins: [
new CopyPlugin({
patterns: [
{
from: `${path.dirname(
require.resolve(`@namespace/translations/package.json`)
)}/locales`,
to: "./public/locales",
toType: "dir",
},
],
}),
],
},
What is expected?
That all files from the /locale
directory of the translations
node_module in the yarn workspace are copied to the /public
folder of the vue app, both when you run yarn serve
and yarn build
. When running yarn serve
, the files should be kept in sync and any changes in the source package should be immediately copied to the destination.
What is actually happening?
running yarn serve
with the current config results in a loop. The correct files are copied to the /public
folder, but at the same time, it creates the /dist
folder and floods it with ...hot-update.json
files.
if I run yarn build
for the first time, the locale files get copied to the /public
folder, but not to the /dist
folder (so it seems it copies the files at the end of the process, so the latest files aren't included in the /dist
folder - it first builds, and then copies)