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

fix: revert to node16, build to mjs, and use more modern ulid package #28

Merged
merged 1 commit into from
Nov 19, 2022

Conversation

thantos
Copy link
Contributor

@thantos thantos commented Nov 19, 2022

  • Lambda node18 and @AWS-SDK seem to have worse cold start times.
  • Replaced ulid with ulidx as ulid has not been updated in 5 years and contains dynamic requires.
  • Bundle into .mjs with end to end ESM. We'll now get top level await and other benefits.

@thantos thantos requested a review from sam-goodwin November 19, 2022 06:11
@sam-goodwin
Copy link
Owner

Was there anything wrong with the ulid library

Comment on lines +84 to +94
/**
* Allows ESM module bundles to support dynamo requires when necessary.
*/
function esmPolyfillRequireBanner() {
return {
js: [
`import { createRequire as topLevelCreateRequire } from 'module'`,
`const require = topLevelCreateRequire(import.meta.url)`,
].join("\n"),
};
}
Copy link
Owner

Choose a reason for hiding this comment

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

Does this mess with source maps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

evanw/esbuild#531

Looks like it will not break them

@thantos
Copy link
Contributor Author

thantos commented Nov 19, 2022

Was there anything wrong with the ulid library

It had not been updated since 2018, was not being maintained, and had dynamic requires that would break ESM.

@thantos thantos requested a review from sam-goodwin November 19, 2022 07:29
@thantos thantos merged commit bdaad81 into main Nov 19, 2022
@thantos thantos deleted the sussman/performant_lambda branch June 16, 2023 14:59
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