diff --git a/packages/nx/src/command-line/login/login.ts b/packages/nx/src/command-line/login/login.ts index 6b8c74ef51ec1..9d22e738f33ac 100644 --- a/packages/nx/src/command-line/login/login.ts +++ b/packages/nx/src/command-line/login/login.ts @@ -1,6 +1,7 @@ import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager'; import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options'; import { handleErrors } from '../../utils/handle-errors'; +import { findAncestorNodeModules } from '../../nx-cloud/resolution-helpers'; export interface LoginArgs { nxCloudUrl?: string; @@ -15,6 +16,10 @@ export function loginHandler(args: LoginArgs): Promise { return handleErrors(args.verbose, async () => { const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions())) .nxCloudClient; + + const paths = findAncestorNodeModules(__dirname, []); + nxCloudClient.configureLightClientRequire()(paths); + await nxCloudClient.commands.login(); }); } diff --git a/packages/nx/src/command-line/logout/logout.ts b/packages/nx/src/command-line/logout/logout.ts index 1e5b49035dcd9..b14ef54a79c2e 100644 --- a/packages/nx/src/command-line/logout/logout.ts +++ b/packages/nx/src/command-line/logout/logout.ts @@ -1,6 +1,7 @@ import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager'; import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options'; import { handleErrors } from '../../utils/handle-errors'; +import { findAncestorNodeModules } from '../../nx-cloud/resolution-helpers'; export interface LogoutArgs { verbose?: boolean; @@ -10,6 +11,10 @@ export function logoutHandler(args: LogoutArgs): Promise { return handleErrors(args.verbose, async () => { const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions())) .nxCloudClient; + + const paths = findAncestorNodeModules(__dirname, []); + nxCloudClient.configureLightClientRequire()(paths); + await nxCloudClient.commands.logout(); }); }