api_graphql_issues - wwwsolutions/nestjs-starter-kit GitHub Wiki

Nx NestJs Starter

ISSUES

  • Buildable library depends on another library

    ERROR

    nx run api-config-app:build
    
    // --> ERROR
    libs/api/config/app/src/lib/api-config-app.module.ts:6:36 - error TS6059: File 'E:/repos-starters/wwwsolutions-nest-starter/libs/api/config/mongo/src/index.ts' is not under 'rootDir' 'libs/api/config/app'. 'rootDir' is expected to contain all source files.
    

    SOLUTION

    • Library project.json MUST HAVE targets.build field.
    • For example, command nx generate @nrwl/workspace:library --name=xyz will not produce build field.

  • NODE_ENV is always set to developer.

    ERROR In NestJs/Nodejs app in Nx.Dev workspace process.env.NODE_ENV is replaced during compilation from typescript to javascript very "smart way" to "development" string constant (everything like NODE_ENV is replaced).

    SOLUTION

    Only way how can I get real NODE_ENV in runtime is this code:

    //process.env.NODE_ENV
    process.env['NODE' + '_ENV']

    REFERENCES

    process.env.NODE_ENV always 'development' when building nestjs app with nrwl nx



⚠️ **GitHub.com Fallback** ⚠️