Sergei Illarionov
Sergei Illarionov

Reputation: 743

no main.js file in the dist running default nest build

I have nest js application api-gateway with types git submodule outside api-gateway.

/app # ls
api-gateway  types

The structure of api-gateway

/app/api-gateway # ls
Dockerfile.dev       dev.env              node_modules         prod.env             tsconfig.json
Dockerfile.prod      dist                 package-lock.json    src
api-gateway.docs.md  nest-cli.json        package.json         tsconfig.build.json

enter image description here

I have following tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2021",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": false,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "paths": {
      "@response_types/*": [
        "../types/responses/*"
      ]
    }
  },
  "include": [
    "src/**/*",
    "../types/**/*"
  ]
}

When i use npx nest build i get dist with no main.js file :enter image description here

/app/api-gateway # ls dist 
api-gateway  types

When i buld it using non-default swc builder

/app/api-gateway # npx nest build --builder swc
>  SWC  Running...
Successfully compiled: 77 files with swc (266.18ms)

All works fine and dist contains main.js file: enter image description here

/app/api-gateway # ls dist
answers            authentication     catalog            firm               nats               product
app.module.js      banners            delivery           main.js            news               user
app.module.js.map  basket             extra_data         main.js.map        order              utils

Whats going wrong with default builder?

Upvotes: 0

Views: 27

Answers (0)

Related Questions