--prod app gets stuck at <ion-app></ion-app>


#1

I have the same app that i built with both --prod and without. Non-prod app will fire up successfully in phone. But --prod app, the component never fires up. This doesn’t happen to tutorial app though. But if it is my app’s syntax error, why does the non-prod app works perfectly? Both build process did not throw any error. Anyone has experienced this problem?

ionic -v => 2.2.2
cordova -v => 6.5.0
angular -v => 4.0.0
typescript -v => 2.2.1
app-scripts -v => 1.3.0

let me know if I can provide other system and build-tool information to help debugging the problem. Thank you.


#2

==== SOVLED ====

I went to platform/build and open up the www folder in the browser. I saw the error. The path of one of my pipes has a capital letter in the file name. But when i import that in ngmodule, i import the file without capital letter in the name. The whole build process did not catch that error and non-minified build works also. Browser version also works. only when --prod minify the file then the error came up. But then this error is not thrown again in the emulator console for some reason.


#3

You could have probably cought it with remote debugging: https://docs.ionic.io/tools/developer/


#4

I’m curious whether this is actually the build system’s fault. Is it possible that you’re building on a case-insensitive filesystem?


#5

I suppose it’s not the build system’s fault. It’s probably something like the minifying process changes the variable names. Hence “CapFirst.pipe.ts” isn’t the same a “capFirst.pipe.ts”. If the names are never changed, the system ignores case difference when reading the file path. But if the build system rename it, it would rename these 2 to totally different things. Hence the app breaks. But that’s just my guess. I don’t really know how ionic minifies and compiles app under the hood.


#6

That would surprise me. So you’re saying you’re certain that the filesystem itself is case-sensitive?


#7

I’m not too sure man. All I can say is in the app.module.ts file, I have an import

import { CapFirstPipe } from "../pipes/capFirst.pipe";

while the actual name of the file was "CapFirst.pipe.ts"
it went fine for $ ionic serve and $ ionic build android/ios

but it breaks with $ Ionic build --prod android/ios
with the following error

Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/charles/Documents/myproject/src/pipes/capFirst.pipe.js'


#8
$ cd /path/to/project
$ echo 'gotcha' > afo
$ cat Afo

If the last command prints “gotcha”, your filesystem is case-insensitive and there’s nothing that the build system could have done. You can clean up from the test with rm afo.


#9

yes then apparently my filesystem is case-insensitive. I’m using macOS. Is it something I can configure?

Edit: well after some quick googling, changing case sensitivity doesn’t seem to be simple. I guess I will live with that.


#10

Yes, but at volume creation time, so you would have to copy all your data to an external disk somewhere, repartition and choose “case sensitive journaled FS” or something when reformatting. I’m sure there are official Apple docs on this.


#11

Thanks for clearing things up.