Skip to content

Conversation

CatsMiaow
Copy link
Contributor

@CatsMiaow CatsMiaow commented Mar 25, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number

I think NestJS is now generally usable in ESM projects.

However, when using dynamic require(import) like @nestjs/swagger module, if the extension is not present, build errors or runtime errors will occur.
This cannot be solved externally and the module needs to be modified.

What is the new behavior?

I added the esmCompatible option to make it work in a custom way, as it shouldn't affect non-ESM projects or other projects.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

050ff34

  • This is a commit that fixed an issue where the package was not recognized when installing from the github repo after forking for testing.
    • e.g. npm install github:CatsMiaow/swagger#fix/esm-compatible
  • If there is an issue with this part, I will revert the commit.

npm test passed, and although it is not minimal, I tested that it works in two environments.

@kamilmysliwiec kamilmysliwiec merged commit d9a9b19 into nestjs:master Apr 11, 2025
1 check passed
@kamilmysliwiec
Copy link
Member

LGTM

@kamilmysliwiec
Copy link
Member

@CatsMiaow could you create a PR to the docs? Mentioning the new configuration attribute

@CatsMiaow CatsMiaow deleted the fix/esm-compatible branch April 14, 2025 06:08
@CatsMiaow CatsMiaow restored the fix/esm-compatible branch April 14, 2025 06:51
@CatsMiaow
Copy link
Contributor Author

While testing the applied code before proceeding with the documentation, I encountered an error in another environment and wrote an additional PR: #3399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants