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

Why node_modules isn't linked in? #87

Closed
adi518 opened this issue Jun 20, 2019 · 8 comments
Closed

Why node_modules isn't linked in? #87

adi518 opened this issue Jun 20, 2019 · 8 comments

Comments

@adi518
Copy link

adi518 commented Jun 20, 2019

When I add a local package with yalc, it links everything but leaves out node_modules. I'm guessing it's by-design, but it means I can't spawn a binary file, because node_modules simply isn't there. If I try to use ./bin, I collide into cross-platform issues (works in Linux, fails on Windows, etc').

@adi518 adi518 changed the title Why does node_modules isn't linked in? Why node_modules isn't linked in? Jun 20, 2019
@wclr
Copy link
Owner

wclr commented Jun 21, 2019

Not sure what you are trying to do. What command do you use to add package?

@adi518
Copy link
Author

adi518 commented Jun 21, 2019

yalc publish and then yalc add my-package. I eventually realized it does add my package node_modules, only they are "hoisted" or added to the main package node_modules. I managed to spawn the binary I needed by using a relative path that points to the main node_modules, so I guess it's fine. 👍

@bramski
Copy link

bramski commented Sep 22, 2021

I am having the opposite problem. My yalc installed package includes it's /node_modules and I do not want that. How can I get yalc not to include node_modules? Our package is rolled up and shouldn't have any included dependencies.

@adi518
Copy link
Author

adi518 commented Sep 22, 2021

I stopped using yalc since yarn workspaces became available. The latter allows you to consume local packages with ease, you just place them in your workspaces directory and hit install. The rest is done for you, and when developing a package and watching for changes, it will trigger a new build in the consuming application without extra steps. I think not many are aware of these amazing capabilities which have saved me what would be otherwise countless hours. In one instance, I was working on integrating six local packages into an application. That would have been a nightmare with yalc.

@adi518 adi518 closed this as completed Sep 22, 2021
@wclr
Copy link
Owner

wclr commented Sep 24, 2021

place them in your workspaces directory

So your workspace now pointing to outside of the project, it is something like yarn/npm link. Yalc allows you to be decoupled from your local environment and be more consistent. If you need things like watching, etc, yalc is not for that kind of workflow.

@wclr
Copy link
Owner

wclr commented Sep 24, 2021

I am having the opposite problem. My yalc installed package includes it's /node_modules

Yalc by default grabs the same content as npm would grab for publishing.

@adi518
Copy link
Author

adi518 commented Sep 24, 2021

@wclr I realized that. Btw, using workspaces doesn't mean you have to incorporate workspaces into a repository and version control. You simply create a local root workspace and clone what you need inside it.

I'm trying to figure out use-cases for yalc, that don't involve having to watch for changes and such.

@wclr
Copy link
Owner

wclr commented Sep 24, 2021

Btw, using workspaces doesn't mean you have to incorporate workspaces into a repository and version control. You simply create a local root workspace and clone what you need

It is just another approach without involving additional tools like yalc.

I'm trying to figure out use-cases for yalc, that don't involve having to watch for changes and such.

Well if you're developing some lib as a separate package it is probably supposed to be self-sufficient. You make some consistent changes (e.g. add/change some functionality), and then push/pull them with yalc. So you have an intermediate step of updating your project(s) here, but it only reflects the nature of those changes that they are consistent. The changes you make to a package refer first of all to the package, and only secondarily to projects that depend on it.

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

No branches or pull requests

3 participants