Since adding `serverless-bundle` and switching to ...
# help
j
Since adding
serverless-bundle
and switching to Yarn/Lerna to support the lerna algo for incremental deploys our build/deploy time has gone up a ton in Seed. It’s not just that we have more services deploying, it seems like like our build time is taking longer. I assume it’s due to webpack bundling. Is there a way to quicken this up via some of the webpack configs?
f
Hey @Jack G, sorry to hear about the slowness. Were you bundling your Lambda functions before (ie. using
serverless-webpack
)?
j
@Frank I think you tagged the wrong person here 😄
f
Ahhhh my bad 🤣
j
We were not doing any bundling previously
Sidenote: We have a Jack and another Jacob on my team and that same mixup in slack happens almost daily
f
Yeah, I’m assuming the most of the slow down is at the
serverless package
step?
@Jay anything Jacob can do to speed up the webpack process? Or do you recommend him taking a look into the
serverless-esbuild
plugin instead?
j
The deployment time itself is moreso an issue for us on hitting the max minutes for our plan when previously we were always well under the max it looks like we may go over for this month due to this
j
Yeah if you weren’t bundling before, then using this will increase the build time. It’s trying to generate an optimized package by removing all the dead code.
j
That bundle is needed to use the yarn/lerna dependency stuff for deployments isn’t it?
j
You could use the new
esbuild
option in
serverless-bundle
. (@Frank we support it in bundle now).
j
I tried that but it still looks like it was bundling with webpack
j
It does use Webpack but for the bundling portion uses esbuild.
j
Actually we still have this in the serverless.yml and it’s still bundling with webpack
Copy code
custom:
  bundle:
    esbuild: true
j
The issue with the Yarn Lerna setup is that Serverless Framework by default doesn’t package these dependencies correctly. The bundle or webpack plugin ensures that it generates a single file out of your functions, fixing that issue.
j
Is that the correct option for using esbuild instead of webpack? Or am I misunderstanding this
j
I think if minutes are a concern, there are a couple of options. You can try the serverless-esbuild plugin and see if that’s faster. You can your setup without these plugins and see if SF is packaging things correctly.
That option uses the esbuild-loader, a plugin for webpack to run esbuild internally.
j
@Alex Ketchum