Skip to content

Generator: Incorrect File Extension in Imports for Generated Client #109

@maaaathis

Description

@maaaathis

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

  1. Generate the client using the provided tool.
  2. Notice that the imports of local files in the generated code include .js extensions.
  3. Attempt to use the generated client in a Next.js project.
  4. Observe the errors related to import paths with .js extensions.

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.

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