Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orval generates wrong import paths in ESM-only package #1232

Open
jakubmazanec opened this issue Feb 21, 2024 · 3 comments
Open

Orval generates wrong import paths in ESM-only package #1232

jakubmazanec opened this issue Feb 21, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jakubmazanec
Copy link

What are the steps to reproduce this issue?

Use custom Axios instance in ESM-only package (i.e. that uses type: "module" in package.json and "module": "node16", "moduleResolution": "node16" in tsconfig.json).

What happens?

Generated code that imports the custom Axios is:

import {customInstance} from './customInstance';

What were you expecting to happen?

Generated code that imports the custom Axios should be:

import {customInstance} from './customInstance.js';

Any logs, error output, etc?

TypeScript errors: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './customInstance.js'? ​typescript(2835)

What versions are you using?

Package Version: 6.25.0

@melloware melloware added the bug Something isn't working label Feb 22, 2024
@melloware
Copy link
Collaborator

Hmmm i wonder if there is a way orval can detect what ts-config you are using? I somehow doubt it.

@jakubmazanec
Copy link
Author

Maybe an option like useExtensionsInImportPaths: true would suffice? Anyway, extensions are mandatory when using ES modules, so it's not just TypeScript-related bug.

@melloware
Copy link
Collaborator

PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants