mittwald / mittwald/api-client-js
Generator: Incorrect File Extension in Imports for Generated Client
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 0
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Problem Description
The generated client currently includes .js file extensions in the imports of local files like the descriptors.js and types.js. This causes issues with frameworks like Next.js, which do not handle these imports correctly. As a result, users are forced to manually remove the .js extension from these imports.
Steps to Reproduce
- Generate the client using the provided tool.
- Notice that the imports of local files in the generated code include
.jsextensions. - Attempt to use the generated client in a Next.js project.
- Observe the errors related to import paths with
.jsextensions.
Example
Here is an example of the problematic import statement:
import * as descriptors from "./descriptors.js";
This needs to be manually corrected to:
import * as descriptors from "./descriptors";
Proposed Solution
Update the client generation logic to omit the .js file extension in the imports of local files. This change should ensure compatibility with frameworks like Next.js and improve the overall usability of the generated client.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the client generation logic used by the provided tool and inspect how local imports such as descriptors.js and types.js are emitted. Reproduce the generated client, then verify that local imports omit the .js extension and work in a Next.js project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100