temporalio / temporalio/samples-typescript

[Feature Request] ESM support as a comment maybe

Open
#425 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
465
Forks
148
Avg merge
1d 10h
Merged PRs (30d)
11

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in hello-world/src/worker.ts at the workflowsPath example referenced by the issue, and compare the existing require.resolve usage with the proposed ESM form. Confirm the appropriate guidance for these samples; done means the relevant example clearly documents ESM usage without making the existing worker example invalid.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.