When I run ionic serve or gulp build, my /www/build/ directory is being generated, along with several sub-directories. The /www/build/js directory is being generated and contains several files, but the app.bundle.js file is not there. When the app tries to run in my browser, I get a white screen and a 404 Error in my console.
We had "ionic-gulp-browserify-typescript": "^1.1.0", , I changed to "ionic-gulp-browserify-typescript": "1.1.0", (removed the caret) and ran npm install. Then things started working.
Hmm, Iām not seeing this with 1.1.1 installed of the browserify plugin. Testing against a clean install and new project, everything is building fine for me.
Are you getting any errors in your terminal when you build?
I think this only becomes a problem when adding additional third party libraries.
If I create a blank Ionic 2 project and run Ionic serve everything is as expected.
However, if I run npm install lodash --save then typings install lodash and run ionic serve, I get a Typescript compiler error saying cannot find module lodash. This then stops any app.bundle.js file from being generated.
I donāt think this was a problem before I updated my ionic-cli to the latest version
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.9
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.2.4
Xcode version: Xcode 7.3 Build version 7D175
Just posted a comment on another forum post about this too:
It probably only happen if there is error. I have this error and just ignore it was fine before. But this might become issue now
[16:59:03] Finished āsassā after 2.28 s
TypeScript error: C:/ionic/mapleapp-bak/app/providers/connectivity/connectivity.ts(23,37): Error TS2339: Property āconnectionā does not exist on type āNavigatorā.
TypeScript error: C:/ionic/mapleapp-bak/app/providers/connectivity/connectivity.ts(25,36): Error TS2339: Property āconnectionā does not exist on type āNavigatorā.
TypeScript error: C:/ionic/mapleapp-bak/app/providers/connectivity/connectivity.ts(36,35): Error TS2339: Property āconnectionā does not exist on type āNavigatorā.
TypeScript error: C:/ionic/mapleapp-bak/app/providers/connectivity/connectivity.ts(38,36): Error TS2339: Property āconnectionā does not exist on type āNavigatorā.
11.6 MB bytes written (8.00 seconds)
I am still having issues with this, as @mbrookson said i noticed this when installing/uninstalling plugins. i started a brand new project and slowly started moving code across including latest angular fire and it started to work but a few saves later Iām getting errors out of angularfire so i back tracked through steps that once worked that now no longer do.
Updated browserify to 2.0.0,
typings install,
I ripped out angularfire2 from my app completely
and it STILL wont build app.bundle.js
Have you checked that your typings is set up correctly? The newer version uses āglobalDependenciesā rather than āambientDependenciesā now, and also the file āmain.d.tsā has been renamed to āindex.d.tsā
This seems due to newly-added enforcement of TypeScript correctness in ionic-gulp-browserify-typescript 2.0.
By removing the caret as described above, it will use 1.1.1 specifically. With the caret, it will use the newest version >= 1.1.1, which is now 2.0 and fails to build on TS errors. Removing the caret is really not a long-term solution, but allows it to work for now. I faced this too; among other things I think it happens whenever one attempts to dereference generically-declared objects with dot notation. In that case it can be avoided by declaring them to be of type any or being sure to dereference with bracket notation
/**
var t = {};
Object.assign(t, tOrig);
delete t.prop; // TS Error, BUILD FAILS SILENTLY !!! */
var t:any = {}; // *note 'any' type
Object.assign(t, tOrig);
delete t.prop; // OK
When using generic objects as dictionaries (idiomatic JavaScript), one must dereference with bracket syntax (good JS practice anyway, IMO). Dot syntax will throw TypeScript errors, despite being valid JavaScript.
Iām somewhat new to TypeScript, but I donāt really like how this is failing silently. If itās going to fail, there should at least be a message, e.g. āBuild failed due to TypeScript error(s).ā
what variable? Note that this thread is regarding app.bundle.js being not generated. Now we know that the reason is failing due to TS compilation errors after upgrading ionic-gulp-browserify-typescript.
If there is any problem with the migration documetation this is either a bug or something to be possibly clarified. In either case youāll have better chance finding an answer by looking for appropriate migration related thread or creating a new one