nest icon indicating copy to clipboard operation
nest copied to clipboard

refactor(common): Switch TypeScript `module` to `node16`

Open Borewit opened this issue 7 months ago • 2 comments
trafficstars

Switch Node.js compiler option module from commonjs to node16, to preserve dynamic import. With commonjs these are converted to require. This allows to deprecate the load-esm dependency, introduced in 1e43fcb6d39f52e8921311aa20fe3250a4f3aa97.

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

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

What is the current behavior?

Uses load-esm to be able to load ESM module file-type.

Improvement of #14974.

What is the new behavior?

Switches to a more modern version of CommonJS in the TypeScript compiler, which allow dynamic import, which no longer requires load-esm.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Borewit avatar Apr 16 '25 15:04 Borewit

image

image

kamilmysliwiec avatar Apr 17 '25 06:04 kamilmysliwiec

@kamilmysliwiec you mind have look at remaining failing unit tests?

The FileTypeValidator does not seem to recognize any file running in CircleCI. If I run npm run test:cov local, all tests pass.

Borewit avatar Apr 18 '25 14:04 Borewit