nestjs build output formats are not unified

56 views Asked by At

I use Nestjs with Swagger to build an ESM server app.

I investigated the "dist" output and I see all files are compiled as esm (which is the desired behavior), except the dto files are commonjs

Steps to reproduce

1- create a nestjs app with @nestjs/cli

2- add type: module to package.json, and adjust your tsconfig.json to output ESNEXT modules

3- add @nestjs/swagger as a plugin into nest-cli.json

4- generate a resource nest g resource users

5- build

6- check dist/main.js, you'll find it an esm module, whereas dist/users/dto/create-users.dto.js is a commonjs

Env

nestjs: v10.0.0

Node: v20.9.0

OS: ubuntu

the question is:

how to make all output files to be esm

0

There are 0 answers