Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

CommonJS Support #9

@alexluong

Description

@alexluong

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions