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

nx 19.2.2 cannot build repo setup for incremental builds #26483

Closed
1 of 4 tasks
gkamperis opened this issue Jun 10, 2024 · 6 comments · Fixed by #27616
Closed
1 of 4 tasks

nx 19.2.2 cannot build repo setup for incremental builds #26483

gkamperis opened this issue Jun 10, 2024 · 6 comments · Fixed by #27616

Comments

@gkamperis
Copy link

Current Behavior

Instructions followed here do not work
https://nx.dev/recipes/angular/setup-incremental-builds-angular

further more I notice that there is a "tmp" folder created that seems to want to contain the built artefacts instead of the "dist" folder.

This used to work with nx 17 latest and 18 latest

Expected Behavior

The outcome of the described docs

GitHub Repo

https://github.com/gkamperis/nx-incremental-bug

Steps to Reproduce

  1. clone the repo
  2. run nx build my-app-m --parallel

Nx Report

NX   Report complete - copy this into the issue template

Node   : 22.2.0
OS     : win32-x64
npm    : 10.8.1

nx (global)        : 19.2.2
nx                 : 19.2.2
@nx/js             : 19.2.2
@nx/jest           : 19.2.2
@nx/linter         : 19.2.2
@nx/eslint         : 19.2.2
@nx/workspace      : 19.2.2
@nx/angular        : 19.2.2
@nx/devkit         : 19.2.2
@nx/eslint-plugin  : 19.2.2
@nrwl/tao          : 19.2.2
@nx/web            : 19.2.2
@nx/webpack        : 19.2.2
typescript         : 5.4.5

Failure Logs

> nx run my-app-m:build:production

(node:72596) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
- Generating browser application bundles (phase: setup)...
✔ Browser application bundle generation complete.
✔ Browser application bundle generation complete.

./apps/my-app-m/src/app/app.module.ts:8:0-43 - Error: Module not found: Error: Can't resolve '@nx19/my-lib' in 'nx\nx19\apps\my-app-m\src\app'

Error: apps/my-app-m/src/app/app.component.html:1:1 - error NG8001: 'app-nx-welcome' is not a known element:
1. If 'app-nx-welcome' is an Angular component, then verify that it is part of this module.
2. If 'app-nx-welcome' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

1 <app-nx-welcome></app-nx-welcome> <router-outlet></router-outlet>
  ~~~~~~~~~~~~~~~~

  apps/my-app-m/src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.


Error: apps/my-app-m/src/app/app.component.html:1:35 - error NG8001: 'router-outlet' is not a known element:
1. If 'router-outlet' is an Angular component, then verify that it is part of this module.
2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

1 <app-nx-welcome></app-nx-welcome> <router-outlet></router-outlet>
                                    ~~~~~~~~~~~~~~~

  apps/my-app-m/src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.


Error: apps/my-app-m/src/app/app.module.ts:7:29 - error TS2307: Cannot find module '@nx19/my-lib' or its corresponding type declarations.

7 import { MyLibModule } from '@nx19/my-lib';
                              ~~~~~~~~~~~~~~


Error: apps/my-app-m/src/app/app.module.ts:11:12 - error NG1010: Value

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran target build for project my-app-m (7s)

   ×  1/1 failed
   √  0/1 succeeded [0 read from cache]

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@gkamperis
Copy link
Author

incremental builds is quite an advertised feature of Nx
anything on this? has been 6weeks+ with a repro provided....

@gkamperis
Copy link
Author

anyone care to comment? this even has a repro....

@gkamperis
Copy link
Author

latest 19.5.7 still same!

@Coly010
Copy link
Contributor

Coly010 commented Aug 23, 2024

Hi @gkamperis I apologise for the delay in a resolution to this issue. I'm taking a look at it now

@Coly010
Copy link
Contributor

Coly010 commented Aug 23, 2024

@gkamperis The workaround for now is to add the following in your targetDefaults in your nx.json

"build": {
   "dependsOn": ["^build"]
}

Coly010 added a commit that referenced this issue Aug 23, 2024
… is set #26483 (#27616)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When using incremental builds with `@nx/angular:webpack-browser` the
dependent libraries need to be built.
However, there is no target default to force a build to build
dependents.


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Add a targetDefault and update docs to reflect this requirement

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #26483
FrozenPandaz pushed a commit that referenced this issue Aug 26, 2024
… is set #26483 (#27616)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When using incremental builds with `@nx/angular:webpack-browser` the
dependent libraries need to be built.
However, there is no target default to force a build to build
dependents.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Add a targetDefault and update docs to reflect this requirement

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #26483

(cherry picked from commit d9fed4b)
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 Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants