Issues with --prod flag when building my app

Hi there.
I’m having problems when trying to build my app with the --prod flag. I’m getting this error:

[01:38:11]  ionic-app-script task: "build"
[01:38:11]  RangeError: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at Object.SetIterator (native)
    at Set.values (native)
    at Function.from (native)
    at dedupeArray (E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:15167:22)
    at flattenAndDedupeArray (E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:15176:12)
    at CompileMetadataResolver.getNgModuleMetadata (E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:14487:13)
    at CompileMetadataResolver.getNgModuleSummary (E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:14429:52)
    at E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:14521:68
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (E:\Ionic\Food2\node_modules\@angular\compiler\bundles\compiler.umd.js:14516:49)

Other info…
Windows_NT 10.0.17134
argv “C:\Program Files (x86)\nodejs\node.exe” “C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js” “run” “ionic:build” “–prod”
node v6.11.0
npm v3.10.10
code ELIFECYCLE

If anyone can help to sort this issue…
Thanx in advance.

Maybe some idea about that there https://github.com/ionic-team/ionic-app-scripts/issues/954 and there https://github.com/ionic-team/ionic-app-scripts/issues/996

As far as I can see, the error message points me to this function on node_modules@angular\compiler\bundles\compiler.umd.js

function dedupeArray(array) {
    if (array) {
        return Array.from(new Set(array));
    }
    return [];
}

I’ve tried ionic cordova build browser --release --optimizejs --minifyjs --minifycss and it does compile (notice that I’m not including --aot)
What can I do with this??

Post output of your ionic info.

cli packages: (C:\Users\MDC\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 : 1.3.4
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.4.2

System:

    Node : v6.11.0
    npm  : 3.10.10
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

You have extremely outdated ionic-angular and app-scripts, it could be the cause of your issues.

I haven’t tried updating ionic-angular but I’ve already tried updating app-scripts with no luck. The same error

I’ve just updated app-scripts and ionic-angular and getting the same error