OpenAPITools / OpenAPITools/openapi-generator

[REQ] [typescript-axios] ECMAscript module (node 18) compatibility

Open
#15,490 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

ECMAscript modules require full filenames to be specified otherwise you get a

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '...\dist\api' imported from ...\dist\index.js

at runtime. I created a pull request which fixed it for my configuration. This might not yet be complete for all possible generator options. IMHO the full filename shouldn't cause any harm in other use cases (e.g. with prior node versions). But I'm not sure about that and it might make sense to make this optional by a generator option.

(https://github.com/OpenAPITools/openapi-generator/pull/15489)

Jan

Contributor guide

Open the contributing guide

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 by reviewing pull request #15489 and the typescript-axios generator, then reproduce the Node 18 runtime failure where dist/index.js imports dist/api without a full filename. Done means generated clients work with ECMAScript modules under Node 18 across the relevant generator options, without breaking prior Node versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.