samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.79k stars 93 forks source link

How to use with nestjs? #248

Closed kimprosh closed 1 year ago

kimprosh commented 1 year ago

I try to use nestia in a NestJS project but have an error here:

Error on nestia.core.TypedRoute.Post(): no transform has been configured. Configure "tsconfig.json" file following [Guide Documents](https://github.com/samchon/nestia/wiki/Setup#tsconfigjson).

my tsconfig.ts

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "plugins": [
      { "transform": "typescript-transform-paths" },
      { "transform": "typia/lib/transform" },
      { "transform": "@nestia/core/lib/transform" },
      { "transform": "nestia" }
    ],
    "strict": true
  }
}
samchon commented 1 year ago

https://github.com/samchon/nestia/wiki/Setup#ttypescript-2

compile it through ttsc command, or use ts-patch

kimprosh commented 1 year ago

So, Can not use nestjs cli when use nestia in nestjs project?

https://github.com/samchon/nestia/wiki/Setup#ttypescript-2

compile it through ttsc command, or use ts-patch

samchon commented 1 year ago

Nest CLI has webpack option? Then follow webpack configuration.

If not, try ts-patch method and tell me the result.

kimprosh commented 1 year ago

Hm, It seems complex to use nestia in NestJS, right?

samchon commented 1 year ago

It never difficult. What about using npx nestia start <directory> command instead?

kimprosh commented 1 year ago

I tried, and it seems is not a way for run NestJS project normally

samchon commented 1 year ago

Okay, I'll try nest cli and tell you how to.

kimprosh commented 1 year ago

thanks so much!

samchon commented 1 year ago
npx nestia setup --compiler ts-patch

Very easy. Just use ts-patch, then everything be fine.

It would better to change default compiler from ttypescript to ts-patch for who are using NestJS starter kit.

kimprosh commented 1 year ago

It works, tks so much!