Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing emitDecoratorMetadata=true for NestJS projects when using Angular workspace #1996

Closed
da-mkay opened this issue Oct 25, 2019 · 4 comments
Labels
community This is a good first issue for contributing outdated scope: node Issues related to Node, Express, NestJS support for Nx type: enhancement

Comments

@da-mkay
Copy link
Contributor

da-mkay commented Oct 25, 2019

Expected Behavior

When adding a new NestJS application to an Angular workspace using the application schematic from the @nrwl/nest package, the application should work out of the box.

Current Behavior

The created app does not work properly. First, it looks like everything is working fine. But as soon as typical NestJS decorators are used, unexpected behaviour can happen. For example, when adding the ValidationPipe using @UsePipes(...) no validation is performed at all. This is because the tsconfig.json files does not contain emitDecoratorMetadata=true.

Failure Information (for bugs)

When using an Angular workspace - no NX workspace - emitDecoratorMetadata is not set by default since Angular 8.1 (see #1801). But emitDecoratorMetadata=true is required for NestJS applications to run properly, as described above.

Either the workspace-schematic or the NestJS application schematic should update the tsconfig accordingly.

I could provide a PR if you tell where I should add this (workspace or NestJS application schematic) and which tsconfig should be updated: in my opinion the app's tsconfig should be updated, not the global one in the root folder.

Steps to Reproduce

  1. Create a workspace with Angular 8.1.
  2. Create NestJS application with schematic.
  3. Add some ValidationPipe with @UsePipes
  4. Check if validation is really performed.
@FrozenPandaz FrozenPandaz added scope: node Issues related to Node, Express, NestJS support for Nx community This is a good first issue for contributing type: enhancement labels Nov 1, 2019
@FrozenPandaz
Copy link
Collaborator

FrozenPandaz commented Nov 1, 2019

The @nrwl/nest:application schematic can be updated to modify the tsconfig.json using the updateJsonInTree method:

We would be glad to accept PRs to address this!

@mehrad-rafigh
Copy link
Contributor

I think we can close this issue @FrozenPandaz

@Cammisuli
Copy link
Member

resolved in #2023

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community This is a good first issue for contributing outdated scope: node Issues related to Node, Express, NestJS support for Nx type: enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants