Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
61 votes
1 answer
30k views

the difference between nx and Lerna ? (monorepos)

hello i'm in new in monorepos world and i'm now searching about different monorepos tools and i found two intersting tools Nx(nrwl) and lerna but i didn't understand the real differnce between these ...
anis's user avatar
  • 875
17 votes
8 answers
27k views

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 ...
Chan15's user avatar
  • 999
15 votes
2 answers
15k views

Include a package for some libs in Nrwl/Nx workspace

It seems like in a Nrwl/Nx workspace there is only a single package.json file. Now if we have multiple applications, each dependent on different packages, then we have to include all of those package ...
Esfandiar's user avatar
  • 350
13 votes
8 answers
13k views

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 ...
Hivaga's user avatar
  • 4,296
10 votes
5 answers
31k views

Uncaught SyntaxError: Cannot use 'import.meta' outside a module - Nx Monorepo

I created an angular nx monorepo and created two applications. When I start either of them I get the following error: I already saw some stackoverflow posts were the answers suggested to just add &...
Stefan's user avatar
  • 1,292
8 votes
4 answers
7k views

NX: How to create a NX workspace in an existing empty git repository instead of creating it under a workspace name?

I have an existing repository. I have cleared all the unwanted files as I wanted to start a new NX-integrated project. But, I want to continue using the same repository as there are some files which I ...
shet_tayyy's user avatar
  • 5,665
7 votes
2 answers
5k views

NX Error for Relative Imports within the Same Project

I'm getting an error when using TS aliased paths within the same project: Projects should use relative imports to import from other files within the same project I don't want this behavior. Any idea ...
S. C.'s user avatar
  • 187
7 votes
0 answers
2k views

how can i use absolute paths in same library in NX monorepo

I am working on Nx monorepo. We have 5 library and are using imports like this '../../components/Button' in library. but instead of this, we want to use absolute imports. For example: there are 2 ...
efdali's user avatar
  • 71
6 votes
2 answers
11k views

Is there a better way to build an Angular monorepo app with libraries?

I have several apps in my Angular monorepo project. Also there are about 5 libraries I've written to use across the apps. What I want to know is how to better build/architect these libraries. The ...
Sergey's user avatar
  • 7,536
5 votes
3 answers
7k views

Nx shared asset library

I want my React app in my Nx monorepo to retrieve all the assets in my asset library called common-assets. I managed to do it with my NextJS app like so : project.json of my NextJS app { "$...
Louis Lecouturier's user avatar
5 votes
0 answers
491 views

How to manage databases in a NX workspace

What is the best practice for managing databases in NX? I am using Knex migrations to manage the schema of a database and would like to add this to the NX monorepo to simplify development, deployment, ...
Jonah's user avatar
  • 111
4 votes
1 answer
6k views

Creating NX Monorepo with concrete (older) Angular version

Generating NX Monorepo Workspace (https://nx.dev/) is straight forward here the steps: npx create-nx-workspace (to create empty workspace) yarn add -D @nrwl/angular (to add nx's angular plugin/...
Hivaga's user avatar
  • 4,296
4 votes
2 answers
4k views

Can i update my monorepo nx workspace without upgrading angular version?

Want to move from nx 10 workspace to 12 without moving away from angular 10. nx migrate latest however upgrade also upgrade angular by default. I searched https://nx.dev/previous/angular/core-concepts/...
Magnum23's user avatar
  • 417
4 votes
2 answers
3k views

Angular MonoRepo Nx - use library in application

Situation: I am quite new to Angular and want to create an Angular workspace with multiple applications and libraries. I followed this tutorial to create an Angular workspace with Nx in form of a ...
the_chimp's user avatar
  • 245
4 votes
1 answer
3k views

Sonar Cloud analysis on an NX monorepo

Am just trying to setup a monorepo of angular applications and libraries using NX. Am new to NX but have user sonarcloud before. Now my requirement is to run analysis for the different projects and ...
aneeshere's user avatar
  • 539
3 votes
1 answer
3k views

Nx print a list of affected projects

I see that Nx is deprecating the print-affected command. The alternatives given does not produce the output I want. Right now, I am using nx print-affected --target=<script name> which tells me ...
puter's user avatar
  • 161
3 votes
1 answer
3k views

Nrwl Nx build node project only transpiles main.ts

I'm new to Nrwl and monorepos. I have a node app which I'm trying to build using nx build [project-name]. My node app has a handful of typescript files in a folder structure under the src folder ...
Tom Schreck's user avatar
  • 5,237
3 votes
0 answers
336 views

How to exclude a specific folder within an Nx monorepo library during 'nx affected:test' command

Problem: I work in an Nx monorepo with multiple apps and libraries. One of my libraries (lib-b) has an assets folder that contains non-testable resources. When I make changes inside the assets folder ...
Timur's user avatar
  • 342
3 votes
0 answers
658 views

Webpack - how to determine which project is target for build in webpack

I am building new project based on Monorepo/NX(nrwl) and micro front-end architecture. I have extracted webpack config to build angular projects. there might be several angular projects and using nx ...
Alexander Gharibashvili's user avatar
2 votes
1 answer
4k views

NX how to pass arguments to target dependency

I have the project config set in the package.json as below: "nx": { "targets": { "build": { "outputs": [ "{projectRoot}/dist" ...
puter's user avatar
  • 161
2 votes
1 answer
2k views

Could not find bootstrapApplication call in apps/product/src/main.ts while adding @angular/material with Nrwl Nx Mfa Workspace

I have created a project with the Nx Mfa schema as follows npx create-nx-workspace fetebird --preset=empty npm install --save-dev @nrwl/angular nx g @nrwl/angular:host host --remotes=product,...
San Jaisy's user avatar
  • 16.4k
2 votes
1 answer
2k views

NX Monorepo (14.3.6) no support for $localize (Angular localize)

Here is the case I have installed latest version of nx monorepo (npx create-nx-workspace@latest). Currently latest version of nx is (14.3.6). After this I have added angular localization package (npm ...
Hivaga's user avatar
  • 4,296
2 votes
1 answer
5k views

How to build a NestJs api from a mono repository

I am working on a project where we are storing our code in a monorepo that is "managed" by nrwl. The repo contains a couple angular apps and a couple nestjs apis. Now we want to dockerize the apis to ...
Woozar's user avatar
  • 1,090
2 votes
1 answer
4k views

NX package-based repo: projectRoot vs workspaceRoot?

If I have a package-based monorepo with NX, which directory is projectRoot, and which one is workspaceRoot? From the docs (https://nx.dev/reference/project-configuration): {projectRoot} and {...
scriptin's user avatar
  • 3,090
2 votes
2 answers
2k views

Setup react-i18next with NX Monorepo

I trying to set up i18next inside a monorepo using NX and Module Federation and I'm getting 404, I'm using i18next-http-backend to load the translations async. I've tried to put public/locales/en/...
niltonxp's user avatar
  • 410
2 votes
1 answer
762 views

I want my nx monorep to allow css and sass styling?

I created an nx workspace and added CSS for styling but my project also uses SCSS files. How can I tell my nx workspace to accept SCSS files? Is there a command I can run?
codythedev's user avatar
2 votes
0 answers
362 views

How to change tsconfig.json inside NX Vite library/app builds

Have someone found a way to customise the tsconfig.json for NX project build. When using Vite as bundler? Here is the problem below is a standart NX(18.0.4) vite.config.ts for library. When you do 'nx ...
Hivaga's user avatar
  • 4,296
2 votes
2 answers
3k views

How to find and resolve CD (Circular Dependencies) in NX, React?

I've been working on a Monorepo and apps folder containing 3 projects: admin commerce vendor Beside apps folder, there is libs folder which contains separate folders such as components and etc. I ...
Ali Bahaari's user avatar
2 votes
0 answers
580 views

NX monorepo in a dotnet Angular project

I am doing some research for a new project. This project will use .NET/C# for the backend and now I am investigating about the best way to integrate the frontend in the same repository. There will be ...
chenny's user avatar
  • 921
2 votes
0 answers
223 views

nrwl/nx paths compatibility on Windows and Linux

I got to know about nrwl/nx and started using it. I initialized a monorepo on Windows. There, I added my first app, a react-native app. I noticed that there are a bunch of places that the entry file ...
Sennen Randika's user avatar
1 vote
2 answers
7k views

Ng add @nrwl/workspace throws Cannot read property 'paths' of undefined

I just make a project with the angular cli and then run the command "ng add @nrwl/workspace" to change it to a nrwl workspace. But I am getting the following error "Cannot read property ...
Haso's user avatar
  • 11
1 vote
1 answer
1k views

Passing targets in as a dependency and making sure they output something useful and meaningful to be consumed by next target

I am trying to get a plugin to use run-commands and I want it to run and execute a dependent task and pass the result to my command. In this case, I want to have a dependent target start up a ...
AutomatedTester's user avatar
1 vote
1 answer
480 views

I'm getting "There was an error creating glob patterns, returning an empty array" error in NX monorepo

I have generated a lib (Angular component) but then decided to delete it, and removed all of its references. Also removed its path alias in tsconfig.base.json file, but now my Tailwindcss doesn't work ...
Ali's user avatar
  • 1,420
1 vote
2 answers
1k views

Why is migration.json file not being generated after running the nx migrate latest command?

nx migrate @nrwl/[email protected] Fetching meta data about packages. It may take a few minutes. Fetching @nrwl/[email protected] Fetching @nrwl/[email protected] > NX The migrate command has run ...
Adeyemi Ayomide's user avatar
1 vote
1 answer
721 views

Can I put applications on same folder level as workspace in Angular?

I'm trying to create a few application using Workspace in Angular 8, and I'm wondering whether is possible to have such folder strucuture: |/Myproj |/Workspace | |/Application_1 ...
DiPix's user avatar
  • 5,963
1 vote
2 answers
794 views

How to generate a CSS, SASS, and vanilla JS library in an Nx Integrated monorepo?

I was wondering how to generate a CSS, SASS, and vanilla JS library in an Nx Integrated monorepo? Well, my apps are in Angular, and my 'feature' tagged libs are also Angular components. So far, so ...
Ali's user avatar
  • 1,420
1 vote
1 answer
386 views

NX monorepo Next.js "Invalid hook call" when using jotai

I'm getting an out-of-place "Invalid hook call" error inside of a Next.js app in an NX workspace. I have put together this CodeSandbox. The start command fails when run automatically, so you ...
chocojunkie's user avatar
1 vote
0 answers
329 views

How to manage NX 15 package dependency list in the same way as pre-15?

In versions prior to NX 15 I found that NX's automagic additions of dependencies to work very well for my use case. However, with NX 15 came a change, see: https://github.com/nrwl/nx/issues/12675#...
josephdpurcell's user avatar
1 vote
1 answer
2k views

ReferenceError: jest is not defined when trying to run tests inside a lib in a nx monorepo

I've been trying to run tests inside a lib from a NX monorepo and it's not working. First it's wasn't finding the types, so I added /// <reference types="@types/jest" /> and It was ...
niltonxp's user avatar
  • 410
1 vote
0 answers
576 views

Run Build and Watch in Parallel with Nx

I have a monorepo setup like: └── monorepo/ ├── package.json ├── apps/ │ └── website/ │ └── package.json └── packages/ └── elements/ └── package.json ...
captDaylight's user avatar
  • 2,234
1 vote
0 answers
920 views

Nx typescript error on custom build script

I would like to create a custom build script that compile multiple files from a single app but I always get compilation errors with nx. Here is a dummy project reproducing the error: Create a new ...
Cizia's user avatar
  • 478
1 vote
1 answer
1k views

Can't create an Angular Library on Nx monorepo

I have a monorepo with an Angular App. I'm trying to create a angular lib on my Nx monorepo; to use it later according to DDD with the command npx nx g @nrwl/angular:lib infrastructure --verbose and ...
alambertt's user avatar
  • 156
1 vote
1 answer
736 views

Error while generating Angular component after upgrading from Angular 13 to 14 in nx workspace using `nx migrate`

Need help... Not sure why I'm starting to get these kind of errors after upgrading angular 13 to 14 using nx migrate I can't generate angular component. Using nx g c component-name InvalidInputOptions ...
flyingpluto7's user avatar
  • 1,099
1 vote
0 answers
432 views

Nx/Nrwl - Angular Ui Library: How to construct the library-tree?

Im starting a ui library inside my nx monorepo but Im unsure how to best organize it. I have thought about these options: (1) a UI Library for each UI Component, where each Component has its own ...
Zeitrebell's user avatar
0 votes
1 answer
3k views

NX: How can I use run-many to run multiple targets?

At present, I run: npx nx run-many --all --skip-nx-cache --parallel --target lint to lint all my projects. But, I would like to run lint and type-check. Something like: npx nx run-many --all --skip-nx-...
shet_tayyy's user avatar
  • 5,665
0 votes
1 answer
437 views

@nrwl/react:stories does not generate Storybook stories

I've a package called component-library which contains an index.ts file at the src folder: /packages/component-library/src/index.ts The contents of the index.ts are as follow: export { default as ...
Camilo's user avatar
  • 7,013
0 votes
1 answer
2k views

How to change the template file(s) for an existing nx schematic

I started to use https://nx.dev/ recently to reorganize an existing monorepo with multiple react frontends and redux state management. nx provides the ability to create new redux slices out of the ...
mcmunder's user avatar
  • 435
0 votes
1 answer
122 views

Is NX package-based monorepo do not work with Angular?

My goal is to create module federation example with package-based monorepo angular. Package-based monorepo because I am expecting this scenario: /checkout with Angular 15. /product with Angular 16. ...
Jason Rich Darmawan's user avatar
0 votes
1 answer
465 views

How to generate Angular App shell in an integrated Nx monorepo workspace?

I think the question is self-explanatory... Is there a way to generate Angular App shell in an integrated Nx monorepo workspace? I know that if we call, let's say, nx g @nx/angular:service my-service -...
Ali's user avatar
  • 1,420
0 votes
1 answer
514 views

Nx command modifying project.json in every component when generating libary

I'm working with an Nx monorepo, and I'm using Nx to generate an angular library with the command npx nx g @nrwl/angular:library testapp --directory=myDirectory/directory. When I run this command, ...
Marko360's user avatar