3
ERROR in 'cx-storefront' is not a known element:
  1. If 'cx-storefront' is an Angular component, then verify that it is part of this module.
  2. If 'cx-storefront' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->] ")
Gokul Pandey
  • 171
  • 1
  • 6

2 Answers2

1

The problem was resolved by below two things in Angular >^9.0

  1. disable Ivy compiler option in tsconfig.app.json

    "angularCompilerOptions": { "enableIvy": false }

  2. adding below configuration in the src/app/app.module.ts

    B2cStorefrontModule.withConfig({ backend: { occ: { baseUrl: environment.occBaseUrl, prefix: '/occ/v2/' }, }, context: { baseSite: ['electronics-spa'], }, })

Where occBaseUrl: 'https://localhost:9002' is the property defined in the environment configuration.

Gokul Pandey
  • 171
  • 1
  • 6
  • What helped you was actually *importing `B2cStorefrontModule`*. It exports the `StorefrontComponent` so it's accessible in your `AppComponent`. Ivy is the recommended render engine. Thus *IVY shouldn't be disabled* if not having good enough arguments to do it. – Krzysztof Platis Dec 08 '20 at 11:55
0

Just go to your tsconfig.json file and mark strictTemplates as false. This worked for me.

"angularCompilerOptions": { "strictTemplates": false }