-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better support for monorepos #277
Comments
+1 Experiencing the exact same issue. this becomes even more needed since npm 7 workspaces is out |
+1 |
Any update on this? Currently running into this same issue, its a pain. Any workarounds? @paeolo ? |
As a hacky workaround, I was able to add this to my postinstall. "postinstall": "cp -r ../../package_name node_modules/package_name && patch-package", |
@tappin-kr I didn't use it yet, but I planned to use Yarn 2 and it seems it can handle patches itself without the need for an external package like patch-package |
@paeolo Yes, sure!! but how about those who are not planning on migrating to Yarn 2 just yet(such as myself)? Monorepo is the way to go these days and it would be nice to have patch-package supports it. |
Hello, anything new about this issue ? |
I am wondering if this is an issue with |
Any updates or modern workarounds on this? The solution that @0x0a0d gave isn't relevant to me as I'm using the new version of lerna that simply uses workspaces. |
I also have the same problem and my solution is to set the "--path-dir" as the relative path value after my "patch-package" command. |
having the same issue, using turbo repo. |
Just a note for anyone else possibly facing this with a docker-based setup: in our dockerfile we intentionally ran npm install with --ignore-scripts which meant that our patches were'nt applied. Also had to make sure the patches folder was actually copied into the container |
+1 |
2 similar comments
+1 |
+1 |
Workaround this issue:
|
@sergeyshmakov your solution worked! Thanks a lot, you saved me a lot of time π |
π bug report
On a lerna-based monorepo, there are some issues with patch-package.
Suppose I have this folder structure...
... and suppose I put patch-package dependency in the package
a
together with apostinstall
script.π€ Current Behavior
The package
a
should work in isolation from the top-level folder and other packages.npm i
on the top-level folder, it will install dependencies and so do a npm i ona
(if things are well configured). But probably it willhoist
dependencies ofa
in the top-levelnode_modules
instead of a local one (ie. instead of anode_modules
inside thea
folder).patch-package
will be executed and tries to patch things ina/node_modules
but since dependencies are hoisted in the top-level folder, it will fail (if no symlink are present).π Possible Solution
Add a flag to enable patching of the top-level
node_modules
. ie:find-up
for apackage.json
that contains aworkspaces
field and/or alerna.json
file.node_modules
folder (ie. for instance it doesn't exist) tries to patch the rootnode_modules
(when flag is enabled)π¦ Context
node_modules
ie. nonode_modules
inpackages/a
and I would like patch-package to work out-of-the-box for this kind of situation (with a flag if it's ok).patch-package
π Your Environment
The text was updated successfully, but these errors were encountered: