I can build my ionic 3 app with --prod anymore. the build process starts but then stops and exits on the step 'postprocess started'
Steps to reproduce:
1.npm update
2.ionic cordova build android --prod
Which @ionic/app-scripts version are you using?
I'm using app-scripts 2.1.4
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
`$ ionic cordova build android --prod --release -- --buildConfig=build.json
[INFO] Running app-scripts build: --prod --platform android --target cordova
[12:03:05] build prod started ...
[12:03:05] clean started ...
[12:03:05] clean finished in 100 ms
[12:03:05] copy started ...
[12:03:05] ngc started ...
[12:03:53] ngc finished in 48.27 s
[12:03:53] preprocess started ...
[12:03:53] deeplinks started ...
[12:04:03] deeplinks finished in 9.71 s
[12:04:03] optimization started ...
[12:04:05] copy finished in 60.17 s
[12:04:50] optimization finished in 47.05 s
[12:04:50] preprocess finished in 56.76 s
[12:04:50] webpack started ...
[12:06:04] webpack finished in 74.17 s
[12:06:04] sass started ...
[12:06:04] uglifyjs started ...
[12:06:07] sass finished in 2.99 s
[12:06:07] cleancss started ...
[12:06:12] cleancss finished in 4.56 s
[12:07:54] uglifyjs finished in 110.14 s
[12:07:54] postprocess started ...`
Issue is also here
https://forum.ionicframework.com/t/how-to-debug-app-scripts-postprocess-failing/106762
As a temporary workaround you can run the Ionic build commands manually instead of letting Ionic deal with everything.
The Ionic command runs some other commands underwater. I managed to get a production build working with the following commands
$ ionic build --aot --minifyjs --minifycss --optimizejs
$ cordova build <platform> --prod
Hi @stevengunneweg and @jjacobs33589,
How do I recreate the issue? Can someone upload a sample project?
Thanks,
Dan
@danbucholtz I was just checking to see which process fails exactly but did this in a different project than before and oddly enough it did succeed (though it did take a while, 81.15 seconds to be precise and the node process takes up almost 100% cpu).
In the other project running ionic cordova build ios --prod gets stuck on the cleancss process.
I'm not sure what the difference is between the two projects but I will try to find it.
Same problem even with workaround suggested by @stevengunneweg.
$ ionic build --aot --minifyjs --minifycss --optimizejs
[INFO] Running app-scripts build: --aot --minifyjs --minifycss --optimizejs
[21:48:45] build dev started ...
[21:48:45] clean started ...
[21:48:45] clean finished in 1 ms
[21:48:45] copy started ...
[21:48:45] deeplinks started ...
[21:48:46] deeplinks finished in 151 ms
[21:48:46] ngc started ...
[21:49:06] ngc finished in 20.50 s
[21:49:06] preprocess started ...
[21:49:06] preprocess finished in 165 ms
[21:49:06] webpack started ...
[21:58:30] webpack finished in 563.62 s
[21:58:30] uglifyjs started ...
[21:58:30] sass started ...
[21:58:30] copy finished in 585.40 s
[21:58:32] sass finished in 2.13 s
[21:58:32] cleancss started ...
[21:58:33] cleancss finished in 1.37 s
[21:59:50] uglifyjs finished in 80.58 s
[21:59:50] postprocess started ...
I should have the latests packages:
$ ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3 ios 4.5.1
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 26.0.2
ios-deploy : 1.9.1
Node : v7.9.0
npm : 4.6.1
OS : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235
Misc:
backend : legacy
I had the same problem first on Mac and @stevengunneweg tip didn't help either. Then I executed 'ionic cordova run ios' which worked, then I tried the same command with --prod tag and it worked too and then I tried 'ionic cordova build ios --prod' again and this time it surprisingly worked.
I ended up downgrading app-scripts from 2.1.4 to 2.1.3
When I did this the project ran fine and I could build a production app
it works when you delete .sourcemaps in root of project. hope this can help
I'm having a similar issues, but for me it fails because it cannot find some file:
> @infarm/[email protected] docker:build /Users/rolandjitsu/Projects/infarm/maintenance
> docker run -ti --rm -p 8100:8100 -p 35729:35729 -p 53703:53703 -v "$(pwd):/app:rw" ionic build --aot --minifyjs --minifycss --optimizejs
[INFO] Running app-scripts build: --aot --minifyjs --minifycss --optimizejs
[15:41:05] build dev started ...
[15:41:05] clean started ...
[15:41:05] clean finished in 60 ms
[15:41:05] copy started ...
[15:41:06] deeplinks started ...
[15:41:06] deeplinks finished in 458 ms
[15:41:06] ngc started ...
[15:41:40] ngc finished in 33.77 s
[15:41:40] preprocess started ...
[15:41:40] copy finished in 34.81 s
[15:41:41] preprocess finished in 675 ms
[15:41:41] webpack started ...
[15:42:58] webpack finished in 77.53 s
[15:42:58] uglifyjs started ...
[15:42:58] sass started ...
[15:43:04] sass finished in 5.53 s
[15:43:04] cleancss started ...
[15:43:07] cleancss finished in 3.05 s
[15:43:36] uglifyjs finished in 37.50 s
[15:43:36] postprocess started ...
events.js:182
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open '/app/www/build/10.js.map'
Hello,
This should be resolved in nightly.
To test, please run:
npm install @ionic/[email protected]
Thanks,
Dan
I had the same problem here and now it works again.
Thank you.
This issue is still open with app-scripts 3.1.6
When i do --prod it hangs at:
[11:40:19] webpack started ...
[11:40:21] copy finished in 22.04 s
then it just hangs...
command is: ionic cordova build android --prod --release
i really didn't do anything special, it worked over 1 1/2 years now, since upgrade to latest the problem is there...
acutally this is working:
ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer true
but with only --prod it is not, so there must be a difference somewhere...
same problem here - in my case the plugin https://ionicframework.com/docs/native/in-app-purchase-2/ goes bonkers with --prod (but works with the command line in @nickwinger comment).
I noticed that it works if I use --livereload (to the run command instead of build)
Also having the same exact issue as @nickwinger above, but with app-scripts 3.1.8. Workaround still works
Having the same problem as described from @nickwinger with latest CLI 3.1.9
Steps to reproduce:
1.nvm use 8.9.0/8.9.4/9.0.0/10.0.0
2.npm i -g ionic cordova [email protected]
3.ionic cordova build --prod --aot
4.Even with fix provided from @nickwinger it is not working
5.Even if i put heap_size of node to 8000 gb it consumes the whole memory and garbage collector just cleans it and it is starting from 3 GB and rising again.I left my pc for whole night and in the morning the process was repeating :D
rampage@rampage-ThinkStation-D20:~/Desktop/work/repos/private/fresh-request/client$ ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer true
> npm run ionic:build -- --aot --platform android
> [email protected] ionic:build /home/rampage/Desktop/work/repos/private/fresh-request/client
> ionic-app-scripts build --prod --aot "--aot" "--platform" "android"
[12:22:06] ionic-app-scripts 3.1.6
[12:22:06] build prod started ...
[12:22:06] clean started ...
[12:22:06] clean finished in 1 ms
[12:22:06] copy started ...
[12:22:06] deeplinks started ...
[12:22:07] deeplinks finished in 203 ms
[12:22:07] ngc started ...
[12:22:20] ngc finished in 13.71 s
[12:22:20] preprocess started ...
[12:22:20] preprocess finished in less than 1 ms
[12:22:20] webpack started ...
[12:22:21] copy finished in 14.23 s
<--- Last few GCs --->
[15652:0x3b24460] 107519 ms: Mark-sweep 1401.6 (1451.0) -> 1401.6 (1459.0) MB, 1256.3 / 0.0 ms allocation failure GC
in old space requested
[15652:0x3b24460] 108930 ms: Mark-sweep 1401.6 (1459.0) -> 1401.6 (1447.0) MB, 1409.9 / 0.0 ms last resort GC in old
space requested
[15652:0x3b24460] 110334 ms: Mark-sweep 1401.6 (1447.0) -> 1401.6 (1446.5) MB, 1404.5 / 0.0 ms last resort GC in old
space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x124b0dfa5ee1 <JSObject>
1: isOptionalParameter(aka isOptionalParameter)
[/home/rampage/Desktop/work/repos/private/fresh-request/client/node_modules/typescript/lib/typescript.js:~29475]
[pc=0x293af2ebb4ee](this=0x263c5ce02311 <undefined>,node=0x1bd6b8d67131 <NodeObject map = 0x3c2810835479>)
2: symbolToParameterDeclaration(aka symbolToParameterDeclaration)
[/home/rampage/Desktop/work/repos/private/fresh-request/...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [node]
2: 0x121a2cc [node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
5: v8::internal::Factory::NewStruct(v8::internal::InstanceType) [node]
6: v8::internal::Factory::NewTuple3(v8::internal::Handle<v8::internal::Object>,
v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node]
7: v8::internal::LoadIC::LoadFullChain(v8::internal::Handle<v8::internal::Map>,
v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>,
v8::internal::Handle<v8::internal::Smi>) [node]
8: v8::internal::LoadIC::UpdateCaches(v8::internal::LookupIterator*) [node]
9: v8::internal::LoadIC::Load(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>)
[node]
10: v8::internal::Runtime_LoadIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*) [node]
11: 0x293af270463d
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] ionic:build: `ionic-app-scripts build --prod --aot "--aot" "--platform" "android"`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rampage/.npm/_logs/2018-05-05T09_23_57_331Z-debug.log
[ERROR] An error occurred while running npm run ionic:build -- --aot --platform android (exit code 134)
Ionic Info
cli packages: (/home/rampage/.nvm/versions/node/v8.9.4/lib/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.9
Cordova Platforms : android 7.1.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.9.4
npm : 6.0.0
OS : Linux 4.15
Environment Variables:
ANDROID_HOME : /mnt/5ff78921-fcbf-40b3-b005-1705ed0bfe2c/Android
Misc:
backend : pro
from 1426, you can run the following :
ionic cordova build android --aot --minifyjs --minifycss --release
Instead (careful with the environment variables though)
_When i "ionic cordova build android" ionic v4 then this error displayed. so any solution please?_
Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: chec
k logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
... 48 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
at ChildProcess.whenDone (D:\xampp\htdocs\angage_ionic\platforms\android\cordovanode_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
This issue is still open with app-scripts 3.1.6
When i do --prod it hangs at:
[11:40:19] webpack started ...
[11:40:21] copy finished in 22.04 s
then it just hangs...command is: ionic cordova build android --prod --release
i really didn't do anything special, it worked over 1 1/2 years now, since upgrade to latest the problem is there...
acutally this is working:
ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer truebut with only --prod it is not, so there must be a difference somewhere...
Been struggling with my Ionic3 to build with an --aot flag for months now...Thank you!
use this command to build .apk
i hope it will useful for you.
On Wed, Oct 31, 2018 at 10:24 AM Neil notifications@github.com wrote:
This issue is still open with app-scripts 3.1.6
When i do --prod it hangs at:
[11:40:19] webpack started ...
[11:40:21] copy finished in 22.04 s
then it just hangs...command is: ionic cordova build android --prod --release
i really didn't do anything special, it worked over 1 1/2 years now, since
upgrade to latest the problem is there...
acutally this is working:
ionic cordova build android --release --aot true --environment prod
--output-hashing all --sourcemaps false --extract-css true --named-chunks
false --build-optimizer truebut with only --prod it is not, so there must be a difference somewhere...
Been struggling with my Ionic3 to build with an --aot flag for months
now...Thank you!—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/ionic-team/ionic-app-scripts/issues/1243#issuecomment-434560782,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Akroz5WlNK8mIKGkH-Ix7efYcjwRi3Cxks5uqS0AgaJpZM4Pk7qn
.
I have the same problema and when I use this:
ionic cordova build android --aot --minifyjs --minifycss --release
the build is finished, but i can't install the app:
INSTALL_PARSE_FAILED_NO_CERTIFICATES
If i run ionic cordova run android --prod it happens:
ionic-app-scripts build --prod --target cordova --platform android
[10:19:03] ionic-app-scripts 3.2.1
[10:19:03] build prod started ...
[10:19:03] clean started ...
[10:19:03] clean finished in 3 ms
[10:19:03] copy started ...
[10:19:03] deeplinks started ...
[10:19:03] deeplinks finished in 26 ms
[10:19:03] ngc started ...
[10:19:11] ngc finished in 7.56 s
[10:19:11] preprocess started ...
[10:19:11] preprocess finished in less than 1 ms
[10:19:11] webpack started ...
[10:19:11] copy finished in 7.85 s
I realized that the problem happens when I import AngularFireDatabaseModule to app.module.ts
import { AngularFireDatabaseModule } from '@angular/fire/database';
and
imports: [
// other imports
AngularFireDatabaseModule
],
This issue is still open with app-scripts 3.1.6
When i do --prod it hangs at:
[11:40:19] webpack started ...
[11:40:21] copy finished in 22.04 s
then it just hangs...command is: ionic cordova build android --prod --release
i really didn't do anything special, it worked over 1 1/2 years now, since upgrade to latest the problem is there...
acutally this is working:
ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer truebut with only --prod it is not, so there must be a difference somewhere...
Thank You! Thank You so much! Can we ask you how do you understand that you have to put all those arguments! We fall in research for few days and it was no luck till we find your solution! Thank You again! If it gonna help someone we get it to work properly with ionic-app-scripts 3.2.1! Now we have our app that opening in 4-6 sec and before that trick it was 22-25 sec (for more then 70 pages in project)!
The solution in #1970 by @nilebma works for me.
I know this is old, but I just started to have this problem too.
Try to build for prod gets a core dump.
Any way to narrow down what is causing the issue?
I have tried older versions of code and it still happen so it made me think it has to be something with a plugin. (We share node_modules between apps, but each app has its own plugins folder).
Other apps build fine, just this one app.
I was able to build with this
ionic cordova build android --aot --minifyjs --minifycss --release
Haven't tried to push to production.
I had tried a similar command before. Maybe wasn't running it correctly. But after I ran this.
export NODE_OPTIONS=--max_old_space_size=4096
Was able to build with --prod. That must prove it is a memory problem.
removing "ionic_source_map_type": "#inline-source-map" fixed the problem for me
can confirm issue still persist. when I run ionic cordova run android --prod --release webpack takes forever. I waited for 300min and it still didn't finish. but with the command ionic cordova build android --aot --minifyjs --minifycss --releaseit took 10 sec to produce the apk.
Most helpful comment
This issue is still open with app-scripts 3.1.6
When i do --prod it hangs at:
[11:40:19] webpack started ...
[11:40:21] copy finished in 22.04 s
then it just hangs...
command is: ionic cordova build android --prod --release
i really didn't do anything special, it worked over 1 1/2 years now, since upgrade to latest the problem is there...
acutally this is working:
ionic cordova build android --release --aot true --environment prod --output-hashing all --sourcemaps false --extract-css true --named-chunks false --build-optimizer true
but with only --prod it is not, so there must be a difference somewhere...