Skip to content

Conversation

@rj-au
Copy link
Contributor

@rj-au rj-au commented Jul 11, 2025

For ESModule and CommonJS compatibility.
When using a bundler like Rollup, the handler function is exported as default.

This change defaults to a named export, but has a fallback check for a named export if there is a default export.

@rj-au rj-au force-pushed the api-server-lambdaLoader-import-fallbacks branch from 3a6a238 to 50980b7 Compare July 11, 2025 01:49
@rj-au
Copy link
Contributor Author

rj-au commented Jul 11, 2025

Related PR (lambdaLoader: add discoverfunctionsGlob option): #12063

For ESModule and CommonJS compatibility.
When using a bundler like Rollup, the handler function is exported as default.
@rj-au rj-au force-pushed the api-server-lambdaLoader-import-fallbacks branch from 50980b7 to 24f809c Compare July 11, 2025 03:22
Tobbe added a commit to cedarjs/cedar that referenced this pull request Jul 11, 2025
For ESModule and CommonJS compatibility.
When using a bundler like Rollup, the handler function is exported as
`default`.

This change defaults to a named `handler` export, just like before. But
if an export like that can't be found it'll now also look for a
`default` export with a `handler` property on it.

All credit for this one goes to @richard-stafflink who created the
original PR over at redwoodjs/graphql#12064

---------

Co-authored-by: Richard J <[email protected]>
Tobbe added a commit to cedarjs/cedar that referenced this pull request Jul 11, 2025
For ESModule and CommonJS compatibility.
When using a bundler like Rollup, the handler function is exported as
`default`.

This change defaults to a named `handler` export, just like before. But
if an export like that can't be found it'll now also look for a
`default` export with a `handler` property on it.

All credit for this one goes to @richard-stafflink who created the
original PR over at redwoodjs/graphql#12064

---------

Co-authored-by: Richard J <[email protected]>
@Tobbe Tobbe added the release:fix This PR is a fix label Jul 15, 2025
@Tobbe Tobbe added this to the next-release-patch milestone Jul 15, 2025
@Tobbe Tobbe added the changesets-ok Override the changesets check label Jul 15, 2025
@Tobbe Tobbe enabled auto-merge (squash) July 15, 2025 04:20
@Tobbe Tobbe merged commit 6440940 into redwoodjs:main Jul 15, 2025
53 of 60 checks passed
This was referenced Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changesets-ok Override the changesets check release:fix This PR is a fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants