-
Notifications
You must be signed in to change notification settings - Fork 416
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
Support for yarn Workspaces #438
Comments
Hi @ajhool, thanks for opening this issue. We're big fans of both Yarn Workspaces and Serverless at @EndemolShineGroup, so I thought I might chime in. We got around any issues by disabling hoisting for the Serverless packages in the monorepo, much like the repo you linked to does. Interestingly, this link details a possible downside of that approach, which is that Also, just to get some more feedback on some points you made:
This should be simple enough, the plugin should detect that its in a Yarn Workspace project and check the root and package-local
This part I didn't quite follow, would this be through Lerna or |
@hassankhan Thanks for the response! It has been a while since I posted this issue and have used these packages (although I have an upcoming project that might benefit from this), so other people might be able to answer your questions better than I am able to, currently. As I recall, the bundling of devDependencies was one of the more problematic issues. I'm glad to hear that serverless-webpack does exclude them. That being said, I would double check that this devDependencies exclusion is working correctly. I seem to remember that if As for executing At the time fo the issue, |
My pleasure, @ajhool, thanks for providing context, definitely clarified things 😄
@HyperBrain is this still the case? IIRC the plugin now displays a warning in these situations, right? |
Yes, there should be a warning. BTW: The npm install is IIRC done with the
production flag, as well as it should be for the yarn call.
…On Fri, Apr 26, 2019 at 3:55 AM Hassan Khan ***@***.***> wrote:
My pleasure, @ajhool <https://github.com/ajhool>, thanks for providing
context, definitely clarified things 😄
packages would pull in the devDependencies of the packages that they
depended on, even for production builds
@HyperBrain <https://github.com/HyperBrain> is this still the case? IIRC,
the plugin now shows a warning in these situations, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#438 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKEZXUNDRSOUUYNSWUSHW3PSJOKTANCNFSM4FRBSWHA>
.
|
@hassankhan I also disabled hoisting to no effect. Maybe theres something I'm doing wrong. So my project structure is someting like
Where projects in app folder are all serveless projects. When I try run a script command (which is in
My workspaces config in the root package.json looks like
Tryna figure out why it still can't find the |
Linking these two issues together: #494 There is a half workaround available in a comment I posted over on that issue, but it's not a true fix and has a big caveat I outlined there. |
Thanks to @Tybot204 reply I was able to include internal packages and it seems to work so far, but the syntax has changed a bit. Here's what worked for me: Note: this only helps including internal packages, not with including hoisted packages. |
@j0k3r @magelle thanks so much for the Yarn Workspace support! It works great on a couple of my serverless apps, but one that depends on
You should be able to repro by just including the crypto package in your package.json deps: |
This is a (Bug Report / Feature Proposal)
Feature Proposal
Description
Yarn Workspaces is a useful tool for dependency management in mono repos, Workspaces fragment dependencies across the repo to reduce duplication of shared dependencies. This complicates the packaging process because local node_modules no longer contain the entire dependency set.
For feature proposals:
This feature was first proposed in issue #286 , but that was a large issue about general Yarn support, and it was suggested that a specific Workspaces issue should be opened.
An example of using Workspaces to organize serverless code can be found, here:
https://github.com/tommedema/serverless-mono-example.git
Yarn workspaces make development across multiple packages/microservices in a single repo easier, but it complicates the dependency graph. It would be helpful if serverless-webpack could navigate Yarn Workspaces' dependency graph when creating a package. Ideally, serverless-webpack could be executed across all of the packages in a yarn workspace. This would allow for simple packaging in large microservice repositories
Similar or dependent issue(s):
and
deploy #398Additional Data
The text was updated successfully, but these errors were encountered: