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

MFE remove HOST (nx-console) NX forgets to dismantle the lazy loaded route config to previous remotes #28968

Open
1 of 4 tasks
nhhockeyplayer opened this issue Nov 15, 2024 · 1 comment

Comments

@nhhockeyplayer
Copy link

nhhockeyplayer commented Nov 15, 2024

Current Behavior

SUBJECT: MFE remove remote (nx-console) NX forgets to dismantle the lazy loaded route config

upon removal of remotes

this code should have been deleted but was left behind inside the HOST preventing nx-console from deleting the HOST

HOST ROUTER

export const appRoutes: Route[] = [
    {
        path: 'employee',
        loadChildren: () =>
            loadRemote<typeof import('employee/Routes')>(
                'employee/Routes'
            ).then((m) => m!.remoteRoutes),
    },
    {
        path: 'login',
        loadChildren: () =>
            loadRemote<typeof import('login/Routes')>('login/Routes').then(
                (m) => m!.remoteRoutes
            ),
    },

Expected Behavior

route config should be deleted upon removal of a remote so the host can gracefully be removed

GitHub Repo

https://github.com/nhhockeyplayer/meanstacknh

Steps to Reproduce

create host
nx g @nx/angular:host --directory=apps/host-security --name=host-security --backendProject=gqlBff --dynamic=true --e2eTestRunner=cypress --inlineStyle=true --inlineTemplate=true --skipTests=true --style=scss --tags=host --no-interactive

create remote
nx g @nx/angular:remote --directory=apps/login --host=host-security --name=login --backendProject=gqlbff --skipTests=true --style=scss --tags=remote --viewEncapsulation=Emulated --no-interactive

create remote
nx g @nx/angular:remote --directory=apps/employee --host=host-security --name=employee --backendProject=gqlbff --skipTests=true --style=scss --tags=remote --viewEncapsulation=Emulated --no-interactive

nx g @nx/workspace:remove login

nx g @nx/workspace:remove employee

Nx Report

nx report                      

 NX   Report complete - copy this into the issue template

Node           : 22.9.0
OS             : darwin-x64
Native Target  : x86_64-macos
npm            : 10.9.0

nx (global)        : 20.0.0
nx                 : 20.1.2
@nx/js             : 20.1.2
@nx/jest           : 20.1.2
@nx/eslint         : 20.1.2
@nx/workspace      : 20.1.2
@nx/angular        : 20.1.2
@nx/cypress        : 20.1.2
@nx/devkit         : 20.1.2
@nx/esbuild        : 20.1.2
@nx/eslint-plugin  : 20.1.2
@nx/express        : 20.1.2
@nx/nest           : 20.1.2
@nx/node           : 20.1.2
@nx/playwright     : 20.1.2
@nx/vite           : 20.1.2
@nx/web            : 20.1.2
@nx/webpack        : 20.1.2
nx-cloud           : 19.1.0
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc               : 1.1.26
@fortawesome/angular-fontawesome : 0.15.0
@ionic/angular                   : 6.7.5
@jsverse/transloco               : 7.5.0
@ngrx/component                  : 18.0.2
@ngrx/component-store            : 18.0.2
@ngrx/effects                    : 18.0.2
@ngrx/entity                     : 18.0.2
@ngrx/operators                  : 18.0.2
@ngrx/router-store               : 18.0.2
@ngrx/schematics                 : 18.0.2
@ngrx/store                      : 18.0.2
@ngrx/store-devtools             : 18.0.2
apollo-angular                   : 7.2.1

Failure Logs

nx g @nx/workspace:remove employee-e2e

 NX  Generating @nx/workspace:remove

DELETE apps/employee-e2e/.eslintrc.json
DELETE apps/employee-e2e/playwright.config.ts
DELETE apps/employee-e2e/project.json
DELETE apps/employee-e2e/src/example.spec.ts
DELETE apps/employee-e2e/src
DELETE apps/employee-e2e/tsconfig.json
DELETE apps/employee-e2e
meanstack02@admin meanstacknh % nx g @nx/workspace:remove employee    

 NX  Generating @nx/workspace:remove


 NX   employee is still a dependency of the following projects:

host-security
Error: employee is still a dependency of the following projects:
host-security
    at checkDependencies (/Users/meanstack02/meanstacknh/node_modules/@nx/workspace/src/generators/remove/lib/check-dependencies.js:18:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async removeGenerator (/Users/meanstack02/meanstacknh/node_modules/@nx/workspace/src/generators/remove/remove.js:15:5)
    at async /Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/generate/generate.js:240:26
    at async handleErrors (/Users/meanstack02/meanstacknh/node_modules/nx/src/utils/handle-errors.js:8:24)
    at async Object.handler (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/generate/command-object.js:13:22)

meanstack02@admin meanstacknh % nx g @nx/workspace:remove login

Package Manager Version

npm --version 10.9.0

Operating System

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

Additional Information

please request access to repo if you need access

@nhhockeyplayer
Copy link
Author

Workaround

manually delete the code in router

and it will remove host without incident

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant