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 does lerna bootstrap not npm link? #78

Closed
justin-calleja opened this issue Mar 4, 2016 · 7 comments
Closed

Why does lerna bootstrap not npm link? #78

justin-calleja opened this issue Mar 4, 2016 · 7 comments

Comments

@justin-calleja
Copy link

Hi!

Can anyone explain why lerna bootstrap doesn't do npm link? Instead, I only see a pattern like this in, for example, /Users/justin/path/to/monorepo/packages/pkg2/node_modules/pkg1

module.exports = require("/Users/justin/path/to/monorepo/packages/pkg1");

By npm linking or by some other means, I'm trying to write a monorepo where each package has the following structure:

pkg1:
index.js
a/
b/

I would like inter-dependent repos to be "installed" / linked in such a way as to be able to require/import files like so:

require('pkg1');
require('pkg1/a');
require('pkg1/b');

i.e. lerna bootstrap's solution won't allow this, since only pkg1's main index.js file is exported:

module.exports = require("/Users/justin/path/to/monorepo/packages/pkg1");

Any ideas? Thanks!

@sebmck
Copy link
Contributor

sebmck commented Mar 4, 2016

npm goes bananas when you have symlinks and try to npm install inside of it.

@justin-calleja
Copy link
Author

Thanks @kittens !

Is there any way to work around this? Or is it in the pipeline to support requiring sub-paths in packages? (e.g. require('pkg1/es5/lib/somefile'))?

@justin-calleja
Copy link
Author

The following is working for me (for now):

justin-calleja@aedcd08

Not sure if this is what you want for this project, but if you want a PR, just let me know. Thanks!

@jamiebuilds
Copy link
Contributor

@justin-calleja I did this previously and it caused issues so I had to revert it.

@jamiebuilds
Copy link
Contributor

Merging this ticket into #11 as a duplicate

@justin-calleja
Copy link
Author

@thejameskyle thanks and sorry I didn't catch #11 when browsing through the issues.

Is the npm problem a bit involving to explain? I guess I'll come across it sooner or later if I continue linking.

Copying the dir structure or requiring all other files will suffer from having to re-run lerna bootstrap for every change in any package being depended upon. File watching might make this easier but… feels wrong.

@lock
Copy link

lock bot commented Dec 28, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants