From a8ace71e375be725d4fe3fd9263d3023a2cb4f36 Mon Sep 17 00:00:00 2001 From: Alexey Lavinsky Date: Mon, 22 Mar 2021 19:17:31 +0300 Subject: [PATCH] docs: update (#597) --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 44510fa..18e9a8c 100644 --- a/README.md +++ b/README.md @@ -1142,6 +1142,30 @@ module.exports = { }; ``` +##### `yarn workspaces` and `monorepos` + +When using `yarn workspaces` or` monorepos`, relative copy paths from node_modules can be broken due to the way packages are hoisting. +To avoid this, should explicitly specify where to copy the files from using `require.resolve`. + +**webpack.config.js** + +```js +module.exports = { + plugins: [ + new CopyPlugin({ + patterns: [ + { + from: `${path.dirname( + require.resolve(`${moduleName}/package.json`) + )}/target`, + to: "target", + }, + ], + }), + ], +}; +``` + ## Contributing Please take a moment to read our contributing guidelines if you haven't yet done so.