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

feat: native functions bundle imports #273

Merged
merged 8 commits into from
Jun 21, 2022
Merged

feat: native functions bundle imports #273

merged 8 commits into from
Jun 21, 2022

Conversation

thantos
Copy link
Collaborator

@thantos thantos commented Jun 18, 2022

Fixes #269, Fixes #264

  • Uses esbuild to bundle imports discovered by closure serializer into the function output
  • Add deploymentOnlyModule to move files to force the closure serialize to serialize the functionless code instead of importing. Importing Functionless can cause a large number of unnecessary imports to be bundled.
  • Add tests and snapshots to show the result of bundling native functions from common imports and functionless integrations.

@netlify
Copy link

netlify bot commented Jun 18, 2022

Deploy Preview for effortless-malabi-1c3e77 ready!

Name Link
🔨 Latest commit 63cf7f6
🔍 Latest deploy log https://app.netlify.com/sites/effortless-malabi-1c3e77/deploys/62b1076925c9be0009c3ec5c
😎 Deploy Preview https://deploy-preview-273--effortless-malabi-1c3e77.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@thantos thantos changed the title Function import feat: native functions bundle imports Jun 18, 2022
@thantos thantos added the lambda label Jun 18, 2022
thantos and others added 2 commits June 18, 2022 09:45
Signed-off-by: github-actions <github-actions@github.com>
@sam-goodwin
Copy link
Collaborator

18k lines added?

@sam-goodwin
Copy link
Collaborator

18k lines added?

snapshotting the serialized bundle? Cool, makes a lot of sense.

@thantos
Copy link
Collaborator Author

thantos commented Jun 20, 2022

100% much easier to see. can't wait to make those smaller. Plus I need to bypass your new lines commit metrics. ;-)

@sam-goodwin
Copy link
Collaborator

Add tests and snapshots to show the result of bundling native functions from common imports and functionless integrations.

I think this is completed right? PR ready to merge?

Have you looked into why netlify is failing to build?

@sam-goodwin
Copy link
Collaborator

Plus I need to bypass your new lines commit metrics. ;-)

Upgrade some dependencies, re-arrange yarn.lock ;)

.projenrc.js Show resolved Hide resolved
src/node.ts Show resolved Hide resolved
Comment on lines 9 to 10
// In that case increase explicitly.
const BUNDLED_MAX_SIZE = 500 * 1024;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this excessive? I know we will slowly improve this over time, but 500KB seems excessive for the tests I see below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can lower it, was arbitrary

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowered to 50k with the Aaios test using 500k as it is 300k bundled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Axios is 300k bundled? gah-dam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Function does not bundle require node_modules Is it possible to use a Function as a lambda authorizer?
2 participants