#Nestjs monorepo
14 messages · Page 1 of 1 (latest)
NestJS and Nx share the philosophy of single package versions. That means that if you use the same package in multiple parts of your application, they should share the package version.
I will say that Nest's monorepo mode is underpowered compared to a dedicated monorepo tool like Nx or turbo, in that you really do only get one package.json and that's it. With Nx you can generate a package.json on application build so that it only contains the packages necessary, which is nice.
I am exploring nestjs monorepo
for standard mode
npm run buid command generates the correct build which I can deploy to aws via serverless - works perfectly fine
however for monorepo mode:
npm run build / npm run build [appname] creating only one file in dist folder i.e. main.js which I believe incomplete build or broken build, upon deployment it throws error
Nope, this is correct.. Monorepo mode uses webpack which bundles the files to a single output
Oh ok, thanks for the info @mystic geyser
Actually I was trying to run it via serverless offline / by deploying it to aws .. it is failing
my serverless.yml looks like
service: serverless-example
plugins:
- serverless-offline
provider:
name: aws
runtime: nodejs16.x
functions:
main:
handler: dist/apps/z001/main.handler
events:
- http:
method: ANY
path: /
- http:
method: ANY
path: '{proxy+}'
error:
✖ Unhandled exception in handler 'main'.
✖ /Users/pratiktayade/Documents/work/learn/z001/dist/apps/z001/main.handler is undefined or not exported
You should probably change the serverless config to just point to main as there is not a main.handler file
Oh let me try it out
Tried to point it to just main but it came back saying
Unhandled exception in handler 'main'.
✖ Bad handler
Okay, say normally, what is main.handler, cause I don't see the in your original file list
Hmm, this might not be something I'm aware of how to fix, mainly because I don't use serverless
no worries @mystic geyser
however your input helped me move into the right direction
thank you 🙂