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

Duplicate dependecies of dependencies #8

Open
afreakk opened this issue Apr 10, 2019 · 1 comment
Open

Duplicate dependecies of dependencies #8

afreakk opened this issue Apr 10, 2019 · 1 comment

Comments

@afreakk
Copy link

afreakk commented Apr 10, 2019

It would be nice if this plugin hoisted all dependencies up to node_module root and avoided duplicates.
Currently you can end up with very deep structures, with tons of duplicate dependencies.
Like if your sls-function depend on A and B, and A depend on externalA, but B also depend on externalA.
both A and B could also depend on local dependency C, which would end up like this:

sls-function/node_modules/A/node_modules/externalA
sls-function/node_modules/A/node_modules/C
sls-function/node_modules/B/node_modules/externalA
sls-function/node_modules/B/node_modules/C

When you have duplicate dependencies like this, instanceof wont work properly across duplications either.

@martin-css
Copy link
Contributor

Sorry for the long delay in replying, I'd forgotten about the notification for this issue and was just reminded when another issue came in today.

I agree, this would be a nice feature to have. However, it's not trivial to implement as we are starting to venture into package manager dependency management territory. There's a lot of hidden complexity in matching versions, deciding which module(s) should be hoisted and which one's shouldn't (when different versions of the same package are required).

The ideal solution would be to bypass this and rely upon the decisions that the existing package manager has made when hoisting dependencies, e,g, examine the file tree to determine where to place the symlinks.

I'll have a look at this in the near future when time permits. In the meantime, if anyone else would like to contribute, please feel free! 👍

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

2 participants