From fa9aa77f3ed55d9d39ff9222d75ff2e578454e4d Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 20 Aug 2024 12:53:17 +0300 Subject: [PATCH] fix(switch/checkout) - hide envs not loaded warnings during switch lanes / checkout --- scopes/component/checkout/checkout.main.runtime.ts | 1 + scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts | 5 +++-- scopes/lanes/lanes/lanes.main.runtime.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scopes/component/checkout/checkout.main.runtime.ts b/scopes/component/checkout/checkout.main.runtime.ts index bea225e6f52..6141089adf1 100644 --- a/scopes/component/checkout/checkout.main.runtime.ts +++ b/scopes/component/checkout/checkout.main.runtime.ts @@ -69,6 +69,7 @@ export class CheckoutMain { ) {} async checkout(checkoutProps: CheckoutProps): Promise { + this.workspace.inInstallContext = true; const consumer = this.workspace.consumer; const { version, ids, promptMergeOptions } = checkoutProps; await this.syncNewComponents(checkoutProps); diff --git a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts index 625322f24f1..ef04504cddd 100644 --- a/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts +++ b/scopes/harmony/aspect-loader/aspect-loader.main.runtime.ts @@ -769,9 +769,10 @@ export class AspectLoaderMain { // TODO: improve texts const errorMsg = e.message.split('\n')[0]; const warning = UNABLE_TO_LOAD_EXTENSION_FROM_LIST(ids, errorMsg, neededFor); - this.logger.error(warning, e); if (mergedOptions.ignoreErrors) return; - if (e.code === 'MODULE_NOT_FOUND' && mergedOptions.hideMissingModuleError) return; + if ((e.code === 'MODULE_NOT_FOUND' || e.code === 'ERR_MODULE_NOT_FOUND') && mergedOptions.hideMissingModuleError) + return; + this.logger.error(warning, e); if (mergedOptions.unifyErrorsByExtId) { const needToPrint = some(ids, (id) => !this.failedToLoadExt.has(id)); if (!needToPrint) return; diff --git a/scopes/lanes/lanes/lanes.main.runtime.ts b/scopes/lanes/lanes/lanes.main.runtime.ts index c5083defa73..470eeb3139f 100644 --- a/scopes/lanes/lanes/lanes.main.runtime.ts +++ b/scopes/lanes/lanes/lanes.main.runtime.ts @@ -577,6 +577,7 @@ please create a new lane instead, which will include all components of this lane if (!this.workspace) { throw new BitError(`unable to switch lanes outside of Bit workspace`); } + this.workspace.inInstallContext = true; let mergeStrategy; if (merge && typeof merge === 'string') { const mergeOptions = Object.keys(MergeOptions);