You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 .js extensions.
Attempt to use the generated client in a Next.js project.
Observe the errors related to import paths with .js extensions.
Example
Here is an example of the problematic import statement:
import*asdescriptorsfrom"./descriptors.js";
This needs to be manually corrected to:
import*asdescriptorsfrom"./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.
The text was updated successfully, but these errors were encountered:
I'm confused tbh., since I've never had any issues with this. Is this maybe some kind of ESM vs. CJS thing?
Yes, exactly. The .js endings in internal imports are usually required for ESM-based projects. But if you change the TypeScript moduleResolution to bundler (which Next.js does out-of-the-box) this is no longer required and even breaks the generated files.
Problem Description
The generated client currently includes
.js
file extensions in the imports of local files like thedescriptors.js
andtypes.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
.js
extensions..js
extensions.Example
Here is an example of the problematic import statement:
This needs to be manually corrected to:
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.The text was updated successfully, but these errors were encountered: