(lambda-nodejs): add support for monorepos
See original GitHub issueWhat is the problem?
Rolling my codebase up in a monorepo, I found that trying to build a NodejsFunction
, I get the following error:
Usage Error: Couldn't find a script named "esbuild".
I’m using the following settings in .yarnrc.yml
, which hoists all my node_modules to my monorepo root:
nmMode: hardlinks-global
nodeLinker: node-modules
Reproduction Steps
Here’s a repro.
What did you expect to happen?
I expected it to work.
What actually happened?
Usage Error: Couldn't find a script named "esbuild".
CDK CLI Version
2.3.0 (build beaa5b2)
Framework Version
2.3.0
Node.js Version
v14.18.1
OS
OSX 12.0.1 (21A559)
Language
Typescript
Language Version
4.5.4
Other information
Happy holidays! 😁
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:15 (5 by maintainers)
Top Results From Across the Web
NodeJS mono repository with multiple AWS lambdas
First, we need to add aws-lambda dependencies to our project. $ npm i aws-lambda $ npm i -D @types/aws-lambda.
Read more >Optimizing Node.js dependencies in AWS Lambda
AWS Lambda offers support for Node.js versions 12, ... Node.js reads and parses all dependencies and sources that are required or imported ...
Read more >AWS Lambda Monorepo - Node.js - Daniel Broadhurst
A monorepo is a single repository which stores all the code for multiple independent projects. It can be used to create a single...
Read more >AWS Lambda: how to share code in a monorepo
... can I share business logic between services in a Node.js monorepo?”. ... you need to know to use AWS Step Functions service...
Read more >🚀 The Ultimate Monorepo Starter for Node.js Serverless ...
js Serverless Applications.” Features. ✓ First-Class Typescript Support ✓ DynamoDB Single Table Design ✓ Shared API Gateway ✓ Environments Configuration ✓ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve encountered this error before, as well. It’s a bit confusing, but you need to have
esbuild
in your rootpackage.json
file, not in yourpackages/aws/package.json
file. I tested this on your repro repository and it works (see https://github.com/mikestopcontinues/cdk-mono-yarn-esbuild-issue/pull/1).@blimmer yeah, I saw that. Great insights. Thanks! Sadly
nodeLinker: node-modules
will turn off pnp, but I guess we got to live with that till we get pnp support added 🤷