Skip to content
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

🚧 Add bundledLambdas option for bundling them with esbuild #2178

Closed
wants to merge 1 commit into from
Closed

🚧 Add bundledLambdas option for bundling them with esbuild #2178

wants to merge 1 commit into from

Conversation

iiroj
Copy link
Contributor

@iiroj iiroj commented Dec 4, 2021

This PR adds a new inputs.build.bundledLambdas option:

Name Type Default Value Description
build.bundledLambdas boolean false Experimental Set this to true to use esbuild to minify and bundle your Lambdas into a single file. This greatly decreases the Lambda file size and speeds up cold-boot time.

@codecov
Copy link

codecov bot commented Dec 4, 2021

Codecov Report

Merging #2178 (c89413a) into master (5a33a65) will decrease coverage by 0.90%.
The diff coverage is 29.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2178      +/-   ##
==========================================
- Coverage   83.51%   82.60%   -0.91%     
==========================================
  Files         102      103       +1     
  Lines        3669     3725      +56     
  Branches     1166     1190      +24     
==========================================
+ Hits         3064     3077      +13     
- Misses        593      636      +43     
  Partials       12       12              
Impacted Files Coverage Δ
...ckages/libs/lambda-at-edge/src/lib/bundleLambda.ts 9.09% <9.09%> (ø)
packages/libs/lambda-at-edge/src/build.ts 91.57% <40.90%> (-4.51%) ⬇️
...rless-components/nextjs-component/src/component.ts 86.20% <83.33%> (-0.16%) ⬇️
...ages/libs/core/src/build/lib/readDirectoryFiles.ts 100.00% <100.00%> (ø)
packages/libs/core/src/images/imageOptimizer.ts 80.17% <0.00%> (+0.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a33a65...c89413a. Read the comment docs.

@iiroj
Copy link
Contributor Author

iiroj commented Dec 4, 2021

What do you think about this, @dphang? I didn't write any unit tests yet because I wanted to get some input first on the idea itself.

@dphang
Copy link
Collaborator

dphang commented Dec 4, 2021

Seems promising, but hm, does this fully work with the serverless target? I thought one problem was the generated server-side chunks are dynamically imported by the corresponding pages and I think esbuild can't handle those properly?

@iiroj
Copy link
Contributor Author

iiroj commented Dec 4, 2021

Thanks @dphang, I will investigate. If it doesn't work we need to keep the chunks around.

@iiroj
Copy link
Contributor Author

iiroj commented Dec 5, 2021

@dphang you seem to be correct, and building the integration test directories with chunks does imply the bundled Lambda would be broken. This is relevant: evanw/esbuild#1155.

Let me close this PR for now...

@iiroj iiroj closed this Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants