Ionic ToastController not showing toast afet npm run build, Ionic 8 , Angular 18

The issue is: Using ToastController after build doesn’t shows the toast. Its working as expected with npm run serve , but not when builded . Seems never reaching the poing of console log console.log (‘Message Toast Service 3’); Ionic 8, with Angular 18 .

Also I discovered if add an option “optimization”: false for the build in angular.json its working correctly , but don’t think this is acceptable as solution

export class MessageToastService {
  toastController = inject(ToastController);

  async show(message?: string, duration: number = 3000,
             error?: Error ) {
    console.log ('Message Toast Service');
    if (!message && error) {
      message = error.message;
    }
 export class MessageToastService {
  toastController = inject(ToastController);

  async show(message?: string, duration: number = 3000,
             error?: Error ) {
    console.log ('Message Toast 1');
    if (!message && error) {
      message = error.message;
    }
    console.log ('Message Toast 2');

    try {
      const toast = await this.toastController.create({
        message: message,
        duration: duration,
        position: 'bottom',
        color: 'warning',
      });

      console.log ('Message Toast Service 3');
      await toast.present();
    } catch (e) {
      console.log(e);
    }
  }

}