Erik Slagter
Erik Slagter

Reputation: 239

Production build orderCore is missing

I had to manually upgrade from 3.2 to 4.2 and because I am developing a Angular library, I could not use the schematics to perform the update.

I have got it working on the development build. We are developing a feature library that targets the checkout (Payment Page and Order Confirmation Page) and it works fine.

With the production build (ng build --configuration production), the payment page works fine, but the Order Confirmation page is not working. it complains that orderCore feature is not configured properly.

Note: we are being redirected from an external site, back to the order confirmation page (after authorization). When the page loads, it shows the following error in the log and show a broken my account page.

core.js:6498 ERROR Error: Feature orderCore is not configured properly
    at FacadeFactoryService.getResolver (spartacus-core.js:24825)
    at FacadeFactoryService.create (spartacus-core.js:24867)
    at facadeFactory (spartacus-core.js:24898)
    at orderReturnRequestFacadeFactory (spartacus-order-root.js:13)
    at Object.factory (spartacus-order-root.js:37)
    at R3Injector.hydrate (core.js:11457)
    at R3Injector.get (core.js:11276)
    at NgModuleRef$1.get (core.js:25352)
    at Object.get (core.js:25066)
    at lookupTokenUsingModuleInjector (core.js:3354)

Anyone has an idea if we are missing some configuration in the feature modules?

import { NgModule } from '@angular/core';
import { checkoutTranslationChunksConfig, checkoutTranslations } from '@spartacus/checkout/assets';
import { CHECKOUT_FEATURE, CheckoutRootModule } from '@spartacus/checkout/root';
import { CmsConfig, I18nConfig, provideConfig } from '@spartacus/core';

@NgModule({
  declarations: [],
  imports: [
    CheckoutRootModule,
  ],
  providers: [provideConfig({
    featureModules: {
      [CHECKOUT_FEATURE]: {
        module: () =>
          import('@spartacus/checkout').then((m) => m.CheckoutModule),
      }
    },
  } as CmsConfig),
    provideConfig({
      i18n: {
        resources: checkoutTranslations,
        chunks: checkoutTranslationChunksConfig,
      },
    } as I18nConfig)
  ]
})
export class CheckoutFeatureModule {
}

Upvotes: 0

Views: 484

Answers (1)

i042416
i042416

Reputation: 366

My colleague has provided a proposal:

If you want to use Spartacus Order library, you need to create "order-feature.module.ts" for it. And by default core is bundled together with components. So, in your configuration, you need have this set: "[ORDER_CORE_FEATURE]: ORDER_FEATURE". So, the config is something like this:

const config: CmsConfig = {
    featureModules: {
         [ORDER_FEATURE]: {
                cmsComponents: [
                   ....
                ],
          },
        // by default core is bundled together with components
        [ORDER_CORE_FEATURE]: ORDER_FEATURE,
     },
};

Upvotes: 1

Related Questions