Questions tagged [nx.dev]

For questions about Nx, a suite of powerful, extensible dev tools that help you develop, test, build, and scale Angular applications with fully integrated support for modern libraries like Jest, Cypress, ESLint, and more.

Intro to Nx

Nx is a suite of powerful, extensible dev tools that help you develop, test, build, and scale Angular applications with fully integrated support for modern libraries like Jest, Cypress, ESLint, and more.

10-Minute Nx Overview (YouTube link on image below)

Nx-Dev-Tools

Philosophy

Nx is built on a technology agnostic core that maintains modular units of code and understands the dependency graph between them. Developers comprehend that your app contains two pages that each use a shared button component. Nx uses this same knowledge to provide insights and performance improvements. There's a whole ecosystem of plugins that build on this foundation.

Nx becomes more valuable as you scale, solving problems that are frustrating for small teams, but paralyzing for large teams.

Nx works especially well for monorepos. Each new app added to a monorepo provides more opportunities to share code and tooling but that often comes at the cost of a compounding slowdown in the CI pipeline. Nx ensures that adding another app to the repo does not increase the existing app’s test or build time.

Features

Test (or builds or lints) only the projects affected by a code change. Cache command output locally so that future runs on the same code happen in seconds. The paid Nx Cloud offering allows this cache to be shared across every developer in your organization. Provide a consistent syntax for executing commands. nx build my-app works no matter what framework my-app uses. Automate code modification tasks with generators. Access a thriving ecosystem of plugins from Nrwl and the community.

59 questions
70
votes
5 answers

How to clear Nx cache

I have an Nx monorepo (https://nx.dev). It has a folder with Nx cache (./node_modules/.cache/nx/). Its size for now is over 3GB. Is there a command for clear this cache?
Pax Beach
  • 2,059
  • 1
  • 20
  • 27
8
votes
1 answer

Pre and post build steps in nx.dev

I'm using nx.dev to build and test a web application. The workspace.json contains the scripts to build and test the app, however the build phase still need a pre processing of some files. Is there any way of adding a pre build step (i.e. specify an…
Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
6
votes
2 answers

nx.dev creating first app failure with cannot find module

In trying out nx.dev, I ran this command npx nx generate @nrwl/node:app ghApi and received this error Unable to resolve @nrwl/node:app. Cannot find module '@nrwl/node/package.json' Require stack: -…
Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
4
votes
1 answer

How to configure WebStorm to work with nx lint instead of ESLint?

When working on nx projects with WebStorm (and probably with other JetBrains IDEs) I keep getting this error: Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated.…
Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
4
votes
0 answers

NX.Dev migration from 11 to 12 failed with "EBUSY: resource busy or locked"

On our project, we are using NX.Dev Workspace of version 11.5.1 with Angular of version 11.2.0 and we are trying to update to latest Angular (12.0.5), but once I run command nx migrate latest (which is suggested to me by NX.Dev) I always end-up with…
Pajchel
  • 41
  • 2
3
votes
0 answers

How to add static css file to NX lib

I'm using NX.dev with Angular projects and I have a few projects and libs. Im having a few static CSS/SCSS files I want to share for all projects (Apps & libs) First CSS file - I want to just bundle it in the projects, in order to do that I added it…
Matan Shushan
  • 1,204
  • 1
  • 10
  • 25
3
votes
2 answers

How to add Material UI V5 ThemeProvider in Storybook V6 in NX

I am currently using nx.dev as a monorepo. I have multiple react clients. Thanks to NX I have a central Material Ui Configuration (inside the lib folder). I'm trying to use Storybook inside that mui folder. Unfortunately, the ThemeProvider does not…
maxfromgermany
  • 239
  • 4
  • 17
3
votes
1 answer

Nx build - Another process, with id xxx, is currently running ngcc

I have a Nx monorepo that contains 2 projects. When I build these projects locally everything works as expected, but when I try to build the same projects on the build server I get the error Another process, with id 111, is currently running…
Mr.wiseguy
  • 4,092
  • 10
  • 35
  • 67
3
votes
1 answer

ERR_REQUIRE_ESM from webpack's importing an ESM package

I am building an app using Nx for modularisation and Geckos for the server part. With Nx' default Webpack 5 config for Node I get this error when running the…
Hubert Grzeskowiak
  • 15,137
  • 5
  • 57
  • 74
3
votes
1 answer

Error: 'jsxs' is not exported by node_modules/react/jsx-runtime.js on building publishable react:lib

Current Behavior I have created a sample nx.dev react application with a publishable react library (ui-public). When I try to build the publishable react library it throws below error Repo where is the build is failing:…
nitesh c
  • 39
  • 1
  • 3
3
votes
1 answer

How to forward command into run-commands using NX CLI?

Given I have entries in angular.json that define various commands using the serverless CLI (as an example) "serverless-deploy": { "builder": "@nrwl/workspace:run-commands", "options": { "command": "npx serverless deploy", "cwd":…
williamsandonz
  • 15,864
  • 23
  • 100
  • 186
3
votes
0 answers

Apollo/Express server is not working in nx.dev environment

I'm trying to create a simple graphql backend using apollo-server-express. Doing this in a expressJS application (Github repo) is working as expected: Executing the query query { search { result } } at localhost:4000/graphql returns…
user3142695
  • 15,844
  • 47
  • 176
  • 332
3
votes
0 answers

support optional chaining and nullish oprtor in nx.dev

At the first step I added "typescript": "~3.7.5" and then I added "prettier": "1.19.1" and it should've been enough, but I still getting this error: 'optionalChaining' isn't currently enabled so I tried to add "react-scripts":…
3
votes
0 answers

How to add an external library to nx manually

I am using nx.dev for a new application. I generated a library for my application, now I want to use this library adding in NX applications how to import library in project NX
2
votes
1 answer

nx workspace angular monorepo throws error while creating new app

I am creating new angular monorepo application, I run following command: npx create-nx-workspace explorer --preset=angular but I am getting following error once it executes: √ Installing dependencies with npm × Creating your workspace in explorer …
Vikas Kad
  • 1,013
  • 1
  • 18
  • 38
1
2 3 4