Skip to content

fix: add workerd condition for password export#17

Merged
bytaesu merged 2 commits into
better-auth:mainfrom
GautamBytes:fix/workerd-password-export
May 27, 2026
Merged

fix: add workerd condition for password export#17
bytaesu merged 2 commits into
better-auth:mainfrom
GautamBytes:fix/workerd-password-export

Conversation

@GautamBytes

@GautamBytes GautamBytes commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a workerd condition for the ./password export.
  • Route Cloudflare Workers resolution to the node-compatible password implementation when nodejs_compat is enabled.
  • Add a regression test for the package export map.

Why

Wrangler uses the workerd conditional export key when bundling Cloudflare Workers. Without a workerd condition, @better-auth/utils/password falls through to the default ESM export and bundles the pure JS fallback instead of password.node.mjs, even when Workers has Node compatibility enabled.

Related to better-auth/better-auth#9649.

@reybahl

reybahl commented May 22, 2026

Copy link
Copy Markdown

need this too -- thanks!!

@GautamBytes

Copy link
Copy Markdown
Contributor Author

@ping-maxwell can u review this?

@bytaesu bytaesu self-assigned this May 27, 2026
@bytaesu

bytaesu commented May 27, 2026

Copy link
Copy Markdown
Member

Hi @GautamBytes, I removed the test file since it doesn't provide much value for testing here!

@bytaesu bytaesu merged commit ffc1d07 into better-auth:main May 27, 2026
1 check passed
@bytaesu

bytaesu commented May 27, 2026

Copy link
Copy Markdown
Member

Hey @GautamBytes, I merged it normally, so I redid it as a squash merge to preserve your contribution history.

@GautamBytes GautamBytes deleted the fix/workerd-password-export branch May 27, 2026 08:43
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.

3 participants