samchon / nestia

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

Very slow reaction on NX dev + loaders error #885

Open anteqkois opened 2 months ago

anteqkois commented 2 months ago

Summary

I'm using NX monorepo, Four of my controllers can't be build due to given errors:

 ERROR in ../../libs/nest-core/src/modules/flows/connectors/connectors.controller.ts 53:358
 Module parse failed: Unexpected token (53:358)
 File was processed with these loaders:
  * ../../node_modules/.pnpm/ts-loader@9.4.4_typescript@5.4.2_webpack@5.88.1/node_modules/ts-loader/index.js
 You may need an additional loader to handle the result of these loaders.
 |     tslib_1.__param(1, (0, core_1.TypedBody)({ type: "assert", assert: (input, errorFactory) => {
 |             const __is = input => {
 >                 const $io0 = input => ("ARCHIVE" === input.packageType || "REGISTRY" === input.packageType) && ("OFFICIAL" === input.connectorType || "CUSTOM" === input.connectorType) && ("string" === typeof input.connectorVersion && /^([~^])?[0-9]+.[0-9]+.[0-9]+$/.test(input.connectorVersion)) && ("string" === typeof input.connectorName && (/^@l/. * /.test($input) && input.connectorName.length <= 255)) && ("string" === typeof input.propertyName && input.propertyName.length <= 255) && ("string" === typeof input.stepName && input.stepName.length <= 255) && ("string" === typeof input.flowId && /^[0-9a-f]{24}$/.test(input.flowId)) && ("string" === typeof input.flowVersionId && /^[0-9a-f]{24}$/.test(input.flowVersionId)) && true && (undefined === input.searchValue || "string" === typeof input.searchValue && input.searchValue.length <= 255);
 |                 return "object" === typeof input && null !== input && $io0(input);
 |             };

I noticed that when I remove nestia imports import { TypedBody, TypedParam, TypedQuery, TypedRoute } from '@nestia/core' it controller start working.

The second problem is my dev server reaction to changes. Before using nestia it was normal to around 1s, now It takes more than 15s... I use it only for validation, I don't generate SDK

"@nestia/sdk": "^3.0.5", "nestia": "^5.3.0", "@nestia/core": "^3.0.5", "@nestia/e2e": "^0.4.3", "@nestia/fetcher": "^3.0.5",

I have followed this tuto: https://nestia.io/docs/setup/#nx, and at the beginning, it works fine, but when I finished refactoring it stop working

I have a separate NS js library with types and they are imported in the NestJS lib, which is again imported in NestJS App. I have about 20 controllers and a problem occurs only at these four.

Code occuring the bug

Importing nestia to nestJS controller