Ionic won't build if --prod specificed - ionic-framework

I wanted to build out the web version of my application and fired off the Ionic build --prod command after adding the browser platform.
My Output:
> ionic build --prod
Running app-scripts build: --prod
[09:32:57] build prod started ...
[09:32:57] clean started ...
[09:32:57] clean finished in 58 ms
[09:32:57] copy started ...
[09:32:58] deeplinks started ...
[09:32:58] deeplinks finished in 164 ms
[09:32:58] ngc started ...
[09:33:14] ngc finished in 16.15 s
[09:33:14] preprocess started ...
[09:33:14] preprocess finished in 4 ms
[09:33:14] webpack started ...
[09:33:14] copy finished in 16.98 s
I've let the process sit for at least an hour, but it never progresses. I don't get any error messages, but it never progresses. Any idea how I can get the project to build?
I'm using Ionic CLI 3.20.0 and Angular 5.2.10.

To run or build you have to use
ionic cordova run android --prod --release
or
ionic cordova build android --prod --release
and please refer to the documentation also https://ionicframework.com/docs/intro/deploying/

Related

ionic cordova run android --prod hangs

My ionic 3 project run OK with ionic cordova run android; however, if I added the --prod flag, i.e. ionic cordova run android --prod The process hangs without any errors. The following is where it stopped:
$ ionic cordova run android --prod
Running app-scripts build: --prod --platform android --target cordova
[23:16:47] build prod started ...
[23:16:47] clean started ...
[23:16:47] clean finished in 8 ms
[23:16:47] copy started ...
[23:16:47] deeplinks started ...
[23:16:47] deeplinks finished in 528 ms
[23:16:47] ngc started ...
[23:17:01] ngc finished in 13.21 s
[23:17:01] preprocess started ...
[23:17:01] preprocess finished in 1 ms
[23:17:01] webpack started ...
[23:17:01] copy finished in 14.49 s
IT STOPPED HERE FOREVER...
I'd retried with many times with same result. The following is my ionic info:
$ ionic info
cli packages: (C:\Users\user\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.1.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 25.2.5
Node : v8.11.2
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Android\android-sdk
Misc:
backend : pro
Please help! Thanks...
Try command
ionic cordova build android --prod --release
Any one still having this issue, a big cause of this problem is PLUGINS
run ionic cordova plugin
And have a look at your list of plugins, and uninstall All the dodgy ones, and those you arent SURE are working by running ionic cordova plugin rm your-plugin-name
This is the problem 98% of the time.

Ionic 3 App is not run on Android device

I can't run app on Android device it is not giving any error. Here is the output of terminal;
Running app-scripts build: --platform android --target cordova
[13:00:25] build dev started ...
[13:00:25] clean started ...
[13:00:25] clean finished in 24 ms
[13:00:25] copy started ...
[13:00:25] deeplinks started ...
[13:00:25] deeplinks finished in 130 ms
[13:00:25] transpile started ...
[13:00:31] transpile finished in 5.76 s
[13:00:31] preprocess started ...
[13:00:31] preprocess finished in 1 ms
[13:00:31] webpack started ...
[13:00:31] copy finished in 6.35 s
[13:00:41] webpack finished in 10.48 s
[13:00:41] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[13:00:44] sass finished in 2.45 s
[13:00:44] postprocess started ...
[13:00:44] postprocess finished in 19 ms
[13:00:44] lint started ...
[13:00:44] build dev finished in 19.37 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\umutg\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk-10
(node:3684) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Requirements check failed for JDK 1.8 or greater
(node:3684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
I think It does not see device, It does not work on another device or emulator. I create new app for trying it's same.
It's about JDK V 10, I uninstalled it and works fine.

How to make a prod build in "Ionic upload" command?

I want to use Ionic deploy service in Ionic cloud.
When I run ionic upload command, a dev build is immediately triggered instead of prod build.
Is it possible to create a --prod build and upload?
One of major reasons is that multiple configurations in my code are bundled with --prod build only.
ionic upload --deploy=dev
[INFO] Running app-scripts build:
[09:55:59] build dev started ...
[09:55:59] clean started ...
[09:55:59] clean finished in 1 ms
You could pipe the npm scripts to run the ionic --prod first and then ionic upload
"scripts":{
"custom-upload":"ionic cordova build --prod | ionic upload"
}
and then run in the terminal
$: npm custom-upload
This will still run the dev build i think but your prod build should be packaged as well. It does not look like you can specify a build type in the ionic upload command, which makes me think that the ionic upload does not upload the production build to ionic view. And if that is that case then you might want to consider changing the configurations setup in a prod build to be set to only be used if not on localhost instead on based on the build.

Ionic 2 Android Production Build loads very slow

I have finished my Ionic 2 App for Android.
For testing I generated my builds with:
cordova build android
These APKs work but the device ready event takes quite a while to fire. No problem.
No I build the productions APK:
cordova build --release android
And the device ready event still happens only after a few seconds. I hoped that this would not be the case in the production version.
ionic run android --prod
This creates a build for debugging and in this build the device ready events fire very fast. But the build is called app-debug.apk.
How can I build a production build that loads fast?
For production (the --prod uses aot which makes load time faster). Also make sure to use ionic middleware instead of cordova
ionic build --release --prod android
To debug in aot:
ionic run android --aot

ionic serve command fails with "build dev failed: Cannot find module '../util/Logger'"

I create and run an ionic project using
ionic start test1 blank --v2
cd test1
ionic serve
And I get:
[13:48:30] ionic-app-scripts 0.0.42
[13:48:30] watch started ...
[13:48:30] build dev started ...
[13:48:30] clean started ...
[13:48:30] clean finished in 1 ms
[13:48:30] copy started ...
[13:48:30] transpile started ...
[13:48:34] transpile finished in 4.04 s
[13:48:34] webpack started ...
[13:48:34] build dev failed: Cannot find module '../util/Logger'
[13:48:35] copy finished in 4.13 s
[13:48:35] watch ready in 4.14 s
I tried to remove the node-modules directory and make "npm install" to rebuild the modules, but with the same result. (even reinstalled ionic framefork)
I have a Linux Mint 18.