ionic-team / ionic-team/ionic-framework

bug: Application not work property on production mode

Open
#30,426 4 comments 0 reactions 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 15h
Merged PRs (30d)
51

Description

### Prerequisites

- [x] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [x] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [x] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

If code is running in dev live mode `ionic capacitor run android -l --external` work correctly - modal is showing
But in production mode `ionic capacitor run android` / `ionic capacitor build android --prod` modal is not showing
In console is only
![Image](https://github.com/user-attachments/assets/5423c58d-c791-4d97-8a09-8c63ef294184)

Example code

```
import { Component, OnInit } from '@angular/core';
import { IonicModule } from '@ionic/angular';

@Component({
standalone: true,
selector: 'app-test',
template: '

Hello Modal!

',
imports: [IonicModule]
})
export class TestPage implements OnInit {
constructor() {
console.log('TestPage constructor called');
}

ngOnInit() {
console.log('TestPage ngOnInit called');
}
}
---
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
imports: [IonHeader, IonToolbar, IonTitle, IonContent, IonButton, IonicModule,TestPage],
})
export class HomePage {
constructor(
private modalCtrl: ModalController,

) { }
async test() {
console.log(this.modalCtrl);
console.log('start');
try {
const modal = await this.modalCtrl.create({
component: TestPage,


});
console.log('Modal object after creation (if await works):', modal);
await modal.present();
console.log('Modal presented!');
} catch (error) {
console.error('Error creating or presenting modal:', error);
}
}
}
----
test

```

### Expected Behavior

Code should work on this samo way in production mode and live mode

### Steps to Reproduce

1. cerate new blank angular type application
2. add capacitor android
3. add new page
4. Create and present ModalController with component from step 3
5. run android capacitor in "not live mode"

### Code Reproduction URL

https://github.com/mzawodzinski/ionicIssue

### Ionic Info

[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module
'@capacitor/ios/package.json'

Require stack:
- /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
- /usr/local/lib/node_modules/@ionic/cli/lib/index.js
- /usr/local/lib/node_modules/@ionic/cli/index.js
- /usr/local/lib/node_modules/@ionic/cli/bin/ionic

Ionic:

Ionic CLI : 7.2.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 8.5.7
@angular-devkit/build-angular : 19.2.13
@angular-devkit/schematics : 19.2.13
@angular/cli : 19.2.13
@ionic/angular-toolkit : 12.2.0

Capacitor:

Capacitor CLI : 7.2.0
@capacitor/android : 7.2.0
@capacitor/core : 7.2.0
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v20.19.0 (/usr/bin/node)
npm : 11.4.1
OS : Linux 6.9

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.