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

feat: allow extension in mutator import #1797

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

henkerik
Copy link
Contributor

@henkerik henkerik commented Jan 8, 2025

Status

Description

Fix #1232 . Orval doesn't support ES modules yet. When adding "type": "module" to the package.json file (and setting TS moduleResolution to node16 or nodenext), the imports should contain an extension. So:

import ... from './some-mutator'

should become:

import .. from './some-mutator.js'

Related PRs

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

> cd samples/react-query/hook-mutator
> (add the new extension flag in the orval.config.js file)
> yarn generate-api

melloware
melloware previously approved these changes Jan 8, 2025
@soartec-lab soartec-lab added the enhancement New feature or request label Jan 10, 2025
@soartec-lab soartec-lab added this to the 7.4.2 milestone Jan 10, 2025
@melloware melloware merged commit ac62fa9 into orval-labs:master Jan 14, 2025
2 checks passed
@@ -30,6 +31,14 @@ export default defineConfig({
// },
// },
// },
// for ES Module imports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henkerik
The commented out tests are not necessary because it is unclear what purpose they serve in the future. Please remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Orval generates wrong import paths in ESM-only package
4 participants