Bulid android --prod looking for .js file?


#1

I can build and test an app on an android phone by running on CLI

ionic cordova build android

and

ionic cordova run android -l

but when I try to build it for production via ionic cordova build android --prod --release, I get the following after “copy finished”…

Error: ./src/pages/ratings/Ratings.ts
Module build failed: Error: ENOENT: no such file or directory, open '/Users/joe/Projects/Mobile/myapp/src/pages/ratings/Ratings.js'
 @ ./src/pages/ratings/ratings.module.ngfactory.js 24:0-33
 @ ./src lazy
 @ ./node_modules/ionic-angular/util/ng-module-loader.js
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts
    at new BuildError (/Users/joe/Projects/Mobile/myapp/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)

Never seen this before. Why the heck is it looking for a .js file??? I’m stuck here, and any suggestions will be highly appreciated.

Thanks.


#2

Hello,
maybe a problem with imports with wrong cases. Take a look that imports strictly match case sensitivity.

Best regards, anna-liebt


#3

Thanks, Anna. I checked every import for the correct case. I noticed the error references “Ratings.ts”, but the file is actually “ratings.ts” (lower case), so I don’t know why it does that.
I even updated every plugin, still no luck.
I don’t get why it works fine without the --prod flag. I can’t upload it to the Google Play Store until I fix this.


#4

Actually, Anna. You’re right. After further digging, I found that the module for the ratings file had this…

import { RatingsPage } from './Ratings';

I changed it to './ratings' and it worked. Thanks a lot!!