Skip to content
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

patch-package is not aware of yarn modules-folder config #102

Open
mrginglymus opened this issue Jan 4, 2019 · 5 comments
Open

patch-package is not aware of yarn modules-folder config #102

mrginglymus opened this issue Jan 4, 2019 · 5 comments

Comments

@mrginglymus
Copy link

applyPatches is hard-coded to use <app_path>/node_modules/<package_name>. It therefore ignores the yarn config of install.modules-folder which might place node_modules elsewhere.

@ds300
Copy link
Owner

ds300 commented Jan 27, 2019

Thanks for the report. I might look into this for a future release, but more likely Yarn 2.0 will come along and make node_modules redundant first 🙃

@ds300
Copy link
Owner

ds300 commented Mar 4, 2021

That comment did not age well 🙈

I'm not sure if many people really use install.modules-folder but I'll keep this in the backlog.

@c-w
Copy link

c-w commented Feb 11, 2023

@ds300 This would be a useful feature for me. I'm using a custom location for the node_modules folder (via yarn install --modules-folder /foo) to avoid issues running on Docker dealing with volume mounts and host/container OS differences. Would it be acceptable for patch-packages to support a similar CLI argument to change the location of the node_modules folder onto which the patches are applied? Happy to work on a pull request if you provide me some direction.

@orta
Copy link
Collaborator

orta commented Feb 11, 2023

Does that information get stored in the lockfile? I think I'd be open to a PR if it could be read from that. However a CLI command would be difficult because it needs to run on the post-install and realistcally there's not a way to add the CLI option in there

@c-w
Copy link

c-w commented Feb 11, 2023

As far as I can see it’s not in the lock file. How about an environment variable? In this way someone could do this:

export NODE_MODULES=/foo
yarn install --modules-folder=$NODE_MODULES
# patch-packages reads $NODE_MODULES and stays in sync with install call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants