Skip to content

ESM module support #133

@tomlarkworthy

Description

@tomlarkworthy

One thing I have noticed is the main export is a commonJS module, hence the examples "require", but this is not idomatic cloudflare worker. Cloudflare workers can support commonJS via their internal workaround https://blog.cloudflare.com/workers-javascript-modules/ but it is not its primary module mechanism, that is ESM.

As I hate breaking backwards compatibility, we can support both by exporting two different packages https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html but I would suggest changing examples to ESM going forward. Of coure, both should be supported in integration tests so we never accidentally regress (see #130)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions