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

CommonJS Support #9

Open
alexluong opened this issue May 29, 2024 · 0 comments
Open

CommonJS Support #9

alexluong opened this issue May 29, 2024 · 0 comments

Comments

@alexluong
Copy link

alexluong commented May 29, 2024

Hi folks, it seems the SDK currently does not support CommonJS. I was able to use it with a bundler just fine but when I set up a simple script with just tsc / ts-node then I couldn't quite get the SDK to play nicely.

Here's a minimal recreation: https://github.com/alexluong/hookdeck-test-ts-sdk

Tested with a few differnt Node versions: v16.14.2, v20.10.0, v22.2.0

Not sure if I'm missing something here. If not, curious if you feel CommonJS support is necessary. This is not a blocker for me but so I figure it's worth a conversation. Thanks!


2 updates:

1: I used vite-node for development and was able to use the package normally. However, I couldn't quite make it production-ready. Whenever I bundle my project code with Vite, it turns into either ESM or CommonJS and won't work well with Hookdeck SDK.

2: The webhook helpers are a bit awkward it seems:

import { verifyWebhookSignature } from "@hookdeck/sdk/webhooks/helpers";

Why don't we export this from the top-level? I also ran into some issue with this separately when trying to build the project.


Can you provide a production-ready TypeScript Node server (Express or whichever works) that uses Hookdeck SDK as an example so I can learn how to set up the build tool?

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

No branches or pull requests

1 participant