Questions tagged [nrwl-nx]

Nx is an open source, next generation build system with first class monorepo support and powerful integrations.

Nx - Smart, Fast and Extensible Build System

Nx is an open source, next generation build system with first-class monorepo support and powerful integrations. It helps you architect, test, and build at any scale, integrating seamlessly with modern technologies and libraries while providing a robust CLI, caching, dependency management, and more.

Nx comes with a set of plugins for TypeScript, Angular, React, Node, Storybook, Cypress, Jest, and more, maintained by the Nx core team and a huge set of community provided extensions.

Find out more on nx.dev and on GitHub.

807 questions
15
votes
6 answers

TypeORM OneToMany causes "ReferenceError: Cannot access '' before initialization"

I have two entities: User and Habit. A user can create multiple Habits, thus I use a OneToMany relation on the User (and ManyToOne on the Habit, respectively). User Entity import {Entity, PrimaryGeneratedColumn, Column, CreateDateColumn,…
15
votes
1 answer

Managing shared styles and assets in Ngrx-nx Monorepo

I am trying to set up shared styles and assets (i.e. fonts) in a nrwl-nx monorepo for use in libraries and apps. My desired outcome is having a library 'theme' that provides shared styles scss variables and mixins fonts for other libs and…
derdaani
  • 538
  • 1
  • 3
  • 12
14
votes
1 answer

Difference between `nx affected:lint --fix` and `nx format:write`

What is the difference between nx affected:lint --fix and nx format:write? Different articles does seem to mention that code should be formatted with nx format:write command, but it doesn't seem that it fully relies on ESLint rules. After formatting…
InsFi
  • 1,298
  • 3
  • 14
  • 29
13
votes
7 answers

Nx CLI run many command is not working for multiple apps

I have tried using Nx in an attempt to make use of Monorepos. I have been facing an issue to serve multiple apps via nx run-many command. Can anyone correct me if I'm doing something wrong? Command used: nx run-many --target=serve --all I can see…
Chan15
  • 929
  • 2
  • 9
  • 16
13
votes
4 answers

Jest "Cannot find module" with typescript paths in CI

On the Gitlab-CI environment 2 of our Jest tests fail with Cannot find module. The strange thing is that it works on my local Win10 machine - even when I run the tests in a similar docker-container (node 12.12.0). Here is the console output: FAIL…
TmTron
  • 17,012
  • 10
  • 94
  • 142
12
votes
1 answer

update an nx-angular project to a specific major version of angular

I am a bit lost in the versioning system of nx (with angular). In my case, I want to upgrade from angular 12 to angular 13 with latest compatible tooling (jest, nx). Agnular 14 is out now. So if I run the command below, it will update to angular…
yonexbat
  • 2,902
  • 2
  • 32
  • 43
12
votes
2 answers

My project doesn't compile with optimization parameters after upgrading from angular 11 to angular 12

I just upgraded an environment with nrwl from angular version 11 to 12 with two angular applications and several libraries. After update when I try to compile using optimization settings: angular.json { .... "optimization": { "scripts": true, …
Conde
  • 785
  • 15
  • 31
12
votes
4 answers

How to enable Swagger for API interfaces shared between NestJS and Angular within Nx monorepo?

I would like to enable Swagger for API interfaces, shared between NestJS and Angular app within an Nx monorepo. Is there a consistent and not workaround-looking way? These are the approaches I haven't succeeded with: Approach 1. Apply…
Andriy Chuma
  • 364
  • 4
  • 7
12
votes
2 answers

Is it possible to rename libs to packages in nx?

I want to rename libs folder that nx creates to packages. Is it something possible with nx?
Jon Sud
  • 10,211
  • 17
  • 76
  • 174
12
votes
2 answers

Use .feature files in cypress with nrwl nx

I have an Angular project with an Nrwl Nx workspace. For my e2e test I use cypress with typescript. For this tests I would like to enable support for Feature files with Gherkin Syntax. I added the "cypress-cucumber-preprocessor" to the project. This…
12
votes
5 answers

Building library with imports from another library using NX Monorepo

Here is the case. I am using Nrwl NX Monorepo. I have 2 libraries lib-a and lib-b both are publishable libraries created via NX. Now I create a MyClass.ts in lib-a. Naturally under paths in workspace/tsconfig.json paths NX creates an alias to this…
Hivaga
  • 3,738
  • 4
  • 23
  • 36
11
votes
1 answer

Nrwl Nx build for production missing node modules bundle

I have a Nrwl Nx repo with different apps (angular, nodejs with express) and shared libs inside. The repo was created with the nx cli and I want to build for production one of the express apps. nx build:production myexpressapp The bundle I get is…
Rares P
  • 303
  • 3
  • 15
10
votes
2 answers

What are the differences between a @nrwl/js library and a @nrwl/workspace library?

I have created both in a testing environment but am still having trouble to differentiate between the use cases of the two. They both have the same file structure, slightly different tsconfig.json file, @nrwl/js library is stricter by 2 extra props.…
fmi21
  • 485
  • 3
  • 15
10
votes
2 answers

@nrwl/nx angular Run all test for coverage in a single test run to get all covered code in my mono repo

I'm running tests in multiple projects of my nx angular monorepo and would like to get a single code coverage report of all projects with all code files covert from the tests. The test-runs seems to scope the analysed code to the current nx project…
Richard Liebmann
  • 416
  • 1
  • 6
  • 19
10
votes
1 answer

Is there any way to set default port for nx react apps

I create multiple apps using nx monorepo, but when I try to run nx run-many to start all apps at once, but I got the error that the port is already taken, which is true. when I run apps one at a time, I can specify a port, but on run-many i can't.…
Kousher Alam
  • 1,005
  • 1
  • 15
  • 30
1
2
3
53 54