Ionic modal error prod build only


#1

Your system information:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v7.4.0
Xcode version: Xcode 8.2.1 Build version 8C1002

├── @angular/common@2.2.1
├── @angular/compiler@2.2.1
├── @angular/compiler-cli@2.2.1
├── @angular/core@2.2.1
├── @angular/forms@2.2.1
├── @angular/http@2.2.1
├── @angular/platform-browser@2.2.1
├── @angular/platform-browser-dynamic@2.2.1
├── @angular/platform-server@2.2.1
├── @ionic/app-scripts@1.0.1
├── @ionic/storage@1.1.6
├── @types/chai@3.4.34
├── @types/lodash@4.14.50
├── cordova@6.5.0
├── ionic@2.2.1
├── ionic-angular@2.0.0
├── ionic-native@2.5.1
├── ionicons@3.0.0
├── lodash@4.17.4
├── ng2-translate@5.0.0
├── npm@4.1.2
├── UNMET PEER DEPENDENCY rxjs@5.1.0
├── sw-toolbox@3.4.0
├── typescript@2.0.10
└── UNMET PEER DEPENDENCY zone.js@0.7.6

We’re migrating to 2.0.0 final and one of our modals when it tries to present causes an exception.

This only occurs with production builds, not default dev builds

The offending piece of code in main.js is the following

ModalDialogView.prototype.present = function() {
        return this.controller.view = this,
        {
            whenVisible: this.ionicApp.present(this, {}, o.AppPortal.MODAL),
            result: this.controller.resultEmitter
        }
    }

and the error is

TypeError: Cannot read property 'MODAL' of undefined
at ModalDialogView.present (main.js:10)
at MarketComponent.confirmBet (main.js:19)
at View_MarketComponent2.handleEvent_0 (main.js:31)
at View_MarketComponent2.<anonymous> (main.js:2)
at SafeSubscriber.t.object.r [as _next] (main.js:23)
at SafeSubscriber.__tryOrUnsub (main.js:2)
at SafeSubscriber.next (main.js:2)
at Subscriber._next (main.js:2)
at Subscriber.next (main.js:2)
at EventEmitter.Subject.next (main.js:5)
at EventEmitter.emit (main.js:23)