Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

My issue with ionic capacitor build --prod ios is that my working components starting with the likes of

<ion-content>
  <ion-grid class="ion-no-padding">
    <ion-row>
      <ion-col>

fail build with

'ion-grid' is not a known element:
1. If 'ion-grid' is an Angular component, then verify that it is part of this module.
2. If 'ion-grid' is a Web Component then add 'CUSTOM_ELEMENT

Without the --prod it works fine. However, without the --prod I am not able to sucessfully run

    import { Component, enableProdMode } from '@angular/core';

    ...

    try{
        enableProdMode();
    }catch{
        this.logger.logError('Prod Mode Failed');
    }

I managed to get --prod to build with setting aot and buildOptimizer in angular.json to false

              "aot": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false,

However, this seems to make the --prod irrelevant? At least enableProdMode is still failing... ?

Adding CUSTOM_ELEMENTS_SCHEMA like proposed here has not made any difference either.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
144 views
Welcome To Ask or Share your Answers For Others

1 Answer

Solved it by importing IonicModule into my component moduels. The boilerplate code from the ionic generate does not include this.

@NgModule({
  imports: [
    CommonModule,
    IonicModule,
  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...