Santiago Pergamo
06/08/2022, 11:17 AMserverless-webpack
to get small-sized lambdas and when I migrated a simple project over SST, I found that with SST I get bigger sized lambdas.Santiago Pergamo
06/08/2022, 11:18 AMcreateUser
with SF outputs 98kB, while with SST 494kB.Santiago Pergamo
06/08/2022, 11:18 AMArpad
06/08/2022, 11:55 AMesbuild
behind the scenes (there's also a SF plugin for that) and it's much faster than webpack. You can use the bundle
property in function and even as a default globally, here's the API for it
https://docs.serverless-stack.com/constructs/Function#functionbundlenodejsprops
You can also use esbuild plugins (e.g. for decorators)Arpad
06/08/2022, 11:57 AMSantiago Pergamo
06/08/2022, 12:33 PMnew Function(stack, 'createUser', {
handler: 'modules/users/useCases/createUser/index.handler',
bundle: {
format: "esm",
minify: true
}
});
I get a smaller size (406.3 kB) but it still falls short of SF's 98kB, could you share your bundle
settings?Arpad
06/08/2022, 12:38 PMaws-sdk
with webpack? Maybe it's getting bundledRoss Coundon
06/08/2022, 1:00 PMRoss Coundon
06/08/2022, 1:00 PMthdxr
06/08/2022, 2:08 PMthdxr
06/08/2022, 2:08 PMesbuild --minify --bundle --format=esm --target=esnext --platform=node ./backend/functions/workspace/events.ts --outfile=output.js --analyze=verbose
thdxr
06/08/2022, 2:08 PM