Skip to content

[Feature Request] ESM support as a comment maybe #425

Description

@tylersayshi

Is your feature request related to a problem? Please describe.

The one thing needed in at least the simpler examples (that I noticed) is to change require.resolve('./workflows.ts') in worker.ts to new URL("./workflows.ts", import.meta.url).pathname

example line: https://github.com/temporalio/samples-typescript/blob/main/hello-world/src/worker.ts#L21

Describe the solution you'd like

Maybe a comment in the code showing the esm solution? (genuinely not sure if this is best solution or not though here)

// Workflows are registered using a path as they run in a separate JS context.
workflowsPath: require.resolve('./workflows'),
// or if using esm:
// workflowsPath: new URL("./workflows.ts", import.meta.url).pathname

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions