Hello,
I've upgraded an Ionic app to the latest version of libs, going from:
"@angular/common": "2.4.8",
"ionic-angular": "2.3.0",
"@ionic/app-scripts": "1.1.4",
To (tried different options below):
"@angular/common": "4.0.2",
"ionic-angular": "3.0.1" / "nightly",
"@ionic/app-scripts": "1.3.4" / "1.3.2",
Everything working great, except I'm getting the following error when trying to minify:
[] ionic-app-scripts 1.3.4
[] minify started ...
[] cleancss started ...
[] uglifyjs started ...
[] ionic-app-script task: "minify"
[] Error: Cannot read property 'filter' of undefined in undefined at line undefined, col undefined, pos
undefined
Error: Cannot read property 'filter' of undefined in undefined at line undefined, col undefined, pos undefined
at BuildError.Error (native)
at new BuildError (C:\appdir\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
at taskReject (C:\appdir\node_modules\@ionic\app-scripts\dist\worker-process.js:36:22)
at C:\appdir\node_modules\@ionic\app-scripts\dist\worker-process.js:14:13
at process._tickCallback (internal/process/next_tick.js:103:7)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "buildminify"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
I'm on Win10, latest Ionic version
I've solved it for now by downgrading to ionic-app-scripts 1.3.1
@xims IMO downgrading und closing the issue for sure is not the solution and also will not help the team to figure out the bug. I think you should reopen the bug the have the attention from the team to resolve the bug dor all us.
Thx
Same bug here!
@xims it's not more a solution
➜ ionic2 git:(dev) ✗ npm install @ionic/[email protected]
xxx@ /opt/git/ionic2
└── UNMET PEER DEPENDENCY @ionic/[email protected]
Yeap, the problem only appears on V1.3.2.
It seems that it's this added line (36 of uglifyjs.ts as of V1.3.2)
const jsFilePaths = context.bundledFilePaths.filter(bundledFilePath => bundledFilePath.endsWith('.js'));
I do not have the time now for investigating this issue, since I'm not acquainted with this project's source code.
Will use V1.3.1 for now (and no, --prod is not working for me).
@akaztp I can't use 1.3.1 it not in npm any more
that's strange, i've just installed it normally moments ago.
npm install @ionic/[email protected]
I've managed to make "--prod" work in V1.3.1.
But after V1.3.1 the uglyfyjs also breaks on a "--prod" build (but with a different error message).
I'm seeing the same thing as @akaztp with v1.3.7.
I just realized that in my case, uglify was choking on es6, which is what I had my TypeScript compiling to. When I switched to es5, --prod worked fine. Hopefully this will help someone else.
I've solved it for my project, use another command.
ionic-app-scripts build --minifyCss --minifyJs
Most helpful comment
I just realized that in my case, uglify was choking on es6, which is what I had my TypeScript compiling to. When I switched to es5, --prod worked fine. Hopefully this will help someone else.