question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using custom builder with workspace.json breaks the nx command

See original GitHub issue

Current Behavior

When using @angular-builders/custom-webpack with workspace.json setup, providing builder option with @angular-builders/custom-webpack breaks the nx ... commands.

Expected Behavior

Nx command should produces same results, no matter which builder I use.

Steps to Reproduce

  1. Create new Nx environment that uses workspace.json.
  2. Install @nrwl/angular with @angular-builders/custom-webpack as dev-dependency.
  3. Add new angular application with nx generate ....
  4. Update workspace.json files as below:
...
"architect": {
    "build": {
         "builder": "@angular-builders/custom-webpack:browser",
         ...
    }
}
...
  1. Save and run nx build command.

In above steps, if you change serve.builder field, instead of build.builder, it will break nx serve command.

Failure Logs

Using nx build command:

> nx run test-app:build 
Cannot determine versions of "@angular/cli".
This likely means your local installation is broken. Please reinstall your packages.

Using nx serve command:

> nx run test-app:serve 
Cannot determine versions of "@angular/cli".
This likely means your local installation is broken. Please reinstall your packages.

Additionally, using ng serve (or ng build) command:

> ng serve
The serve command requires to be run in an Angular project, but a project definition could not be found.

Environment

@nrwl/angular : 9.5.1
@nrwl/cli : 9.5.1
@nrwl/cypress : 9.5.1
@nrwl/eslint-plugin-nx : 9.5.1
@nrwl/express : Not Found
@nrwl/jest : 9.5.1
@nrwl/linter : 9.5.1
@nrwl/nest : 9.5.1
@nrwl/next : Not Found
@nrwl/node : 9.5.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.5.1
@nrwl/web : Not Found
@nrwl/workspace : 9.5.1
typescript : 3.8.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Splaktarcommented, Feb 25, 2021

I’m using

    "@angular-builders/custom-webpack": "^11.0.0",
    "@angular-devkit/build-angular": "0.1102.1",

In the same project with Nx 11.3.x and not seeing problems, so it looks like Nx was indeed fixed to not break in this configuration.

0reactions
brandonrobertscommented, Jan 29, 2021

Closing as resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Which builder to use when using nx with angular.json
It allows you to build your Angular application to a build artifact that can be hosted online. There are some key differences: Supports...
Read more >
nrwl-nx/community - Gitter
i'm using the following command node --inspect-brk ./node_modules/@nrwl/cli/bin/nx.js test libname . if i convert my workspace to an angular-cli powered one, ...
Read more >
Project Configuration - Nx
json files are located in each project's folder. Nx merges the two files to get each project's configuration. The following configuration creates build...
Read more >
Angular CLI and Nx — Why?. In this blog post, I'll present a…
In this blog post, I'll present a comparison of both the Angular CLI and the Nx CLI and present some evaluations on the...
Read more >
How to create a workspace generator as a library in Nx ...
Enters Workspace Generators! With workspace generators you can build your own generators and run them like this: npx nx workspace-generator ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found