Ionic-gulp-browserify-typescript v1.1.1 does not generate app.bundle.js


#1

Hi,
When I update the package ionic-gulp-browserify-typescript to version 1.1.1, app.bundle.js is not generated anymore in my project. However, everything works fine with version 1.1.0. Can somebody help me with suggestions or ideas?

Thanks in advance,
Xavi

package.son:

{
“dependencies”: {
"@angular/common": “2.0.0-rc.1”,
"@angular/compiler": “2.0.0-rc.1”,
"@angular/core": “2.0.0-rc.1”,
"@angular/http": “2.0.0-rc.1”,
"@angular/platform-browser": “2.0.0-rc.1”,
"@angular/platform-browser-dynamic": “2.0.0-rc.1”,
"@angular/router": “2.0.0-rc.1”,
“es6-shim”: “^0.35.0”,
“ionic-angular”: “2.0.0-beta.9”,
“ionic-native”: “1.2.4”,
“ionicons”: “3.0.0”,
“reflect-metadata”: “^0.1.3”,
“rxjs”: “5.0.0-beta.6”,
“zone.js”: “^0.6.12”,
“ng2-translate”: “2.1.0”
},
“devDependencies”: {
“del”: “2.2.0”,
“gulp”: “3.9.1”,
“gulp-watch”: “4.3.5”,
“ionic-gulp-browserify-typescript”: “1.1.1”,
“ionic-gulp-fonts-copy”: “^1.0.0”,
“ionic-gulp-html-copy”: “^1.0.0”,
“ionic-gulp-sass-build”: “^1.0.0”,
“ionic-gulp-scripts-copy”: “^2.0.0”,
“run-sequence”: “1.1.5”
},
“cordovaPlugins”: [
“cordova-plugin-device”,
“cordova-plugin-console”,
“cordova-plugin-whitelist”,
“cordova-plugin-splashscreen”,
“cordova-plugin-statusbar”,
“ionic-plugin-keyboard”,
“cordova-plugin-inappbrowser”,
{
“variables”: {
“SENDER_ID”: “X”
},
“locator”: “https://github.com/phonegap/phonegap-plugin-push”,
“id”: “phonegap-plugin-push”
},
“cordova-sqlite-storage”,
“cordova-plugin-file”,
“cordova-plugin-file-transfer”,
“cordova-plugin-compat”
],
“cordovaPlatforms”: [
“android”,
“browser”,
“ios”,
{
“platform”: “ios”,
“version”: “”,
“locator”: “ios”
}
],
“name”: “X”,
“description”: “X”
}

Project packages installed:

$> npm ls --depth 0
├── @angular/common@2.0.0-rc.1
├── @angular/compiler@2.0.0-rc.1
├── @angular/core@2.0.0-rc.1
├── @angular/http@2.0.0-rc.1
├── @angular/platform-browser@2.0.0-rc.1
├── @angular/platform-browser-dynamic@2.0.0-rc.1
├── @angular/router@2.0.0-rc.1
├── del@2.2.0
├── es6-shim@0.35.1
├── gulp@3.9.1
├── gulp-watch@4.3.5
├── ionic-angular@2.0.0-beta.9
├── ionic-gulp-browserify-typescript@1.1.1
├── ionic-gulp-fonts-copy@1.0.0
├── ionic-gulp-html-copy@1.0.0
├── ionic-gulp-sass-build@1.0.0
├── ionic-gulp-scripts-copy@2.0.1
├── ionic-native@1.2.4
├── ionicons@3.0.0
├── ng2-translate@2.1.0
├── reflect-metadata@0.1.3
├── run-sequence@1.1.5
├── rxjs@5.0.0-beta.6
└── zone.js@0.6.12

Runtime information:

$> ionic info
Ionic Framework Version: 2.0.0-beta.9
Ionic CLI Version: 2.0.0-beta.31
Ionic App Lib Version: 2.0.0-beta.17
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.4.5
Xcode version: Xcode 7.2.1 Build version 7C1002

Global packages:

$> npm ls -g --depth 0
/usr/local/lib
├── cordova@6.2.0
├── ionic@2.0.0-beta.31
├── ios-deploy@1.8.6
├── ios-sim@5.0.8
├── jsdoc@3.4.0
├── npm@2.15.5
└── typings@0.8.1


#2

Hi,
I finally found the problem. Package ionic-gulp-browserify-typescript version 1.1.1 do not output ‘app.bundle.js’ if an error is found, previous version does. My app compilation was showing for a long time an “error” due to the type definition of the Promise.all() function. Basically, the type file cannot specify the return type when the input is a vector of promises, and a “filler/dummy” return type is specified. Therefore, if you specify the actual return type, you get an error. The error can be safely ignored, or the return type should be Array<any> to get rid of the error, explanation here.

Example code:

Promise.all( myVectorOfPromises )
    // Use Array<any> as a hack, in order to avoid a Promise.all()
    // signature weakness in TypeScript. Actually, the type should
    // be Array<MyType>.
    // See: http://stackoverflow.com/questions/33684634/how-to-use-promise-all-with-typescript
    .then( ( results: Array<any> ) => {
        // We only get here if ALL promises fulfill
        results.forEach( ( item: MyType ) => {
            // Process item
            // ... my success code
        } );
     } )
    .catch(
        ( error: Error ) =>
            // Will catch failure of first failed promise
            // ... my error code
    );

Maybe I am wrong, but IMHO such breaking changes should be clearly stated somewhere, even more bearing in ming that Typescript can output errors that are not real errors (due to missing type files, or problems with type files).

Regards,
Xavi


Ionic 2 Not Generating app.bundle.js
#3

Thank you so much ! I spent 2 days finding the problem