[Ionic v4] Build with --prod flag produces -> TypeError: Cannot read property 'minify' of undefined
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior: The problem occurs when executing the command "ionic cordova build android " with the flag --prod, if it runs without the flag, no error occurs.
Expected behavior: The APK generate with success.
Steps to reproduce: The error occurs when you run the following command:
ionic cordova build android --prod
.
Generates:
...
chunk {cordova} cordova.935a9f4e1f7afeca168d.js (cordova) 71.6 kB [entry] [rendered]
ERROR in common.00974306b5124fe008c9.js from Terser
TypeError: Cannot read property 'minify' of undefined
at minify (/home/vini/projects/minify-error/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
at module.exports (/home/vini/projects/minify-error/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
at handle (/home/vini/projects/minify-error/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (/home/vini/projects/minify-error/node_modules/worker-farm/lib/child/index.js:51:3)
at process.emit (events.js:197:13)
at emit (internal/child_process.js:828:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
...
Related code:
Repository with the code that generates the error:
https://github.com/H4ad/minify-errors/
Other information:
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.6.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 4 other plugins)
System:
Android SDK Tools : 26.1.1 (/home/vini/Android/Sdk/)
NodeJS : v11.8.0 (/usr/bin/node)
npm : 6.7.0
OS : Linux 4.15
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:6 (2 by maintainers)
Top Results From Across the Web
[Ionic v4] Build with --prod flag produces -> TypeError: Cannot ...
Current behavior: The problem occurs when executing the command "ionic cordova build android " with the flag --prod, if it runs without the...
Read more >Ionic 3.x Unable to build using the --prod "TypeError
Regular builds work fine as does using --release. ... TypeError: Cannot read property 'kind' of undefined at nodeCanBeDecorated ...
Read more >Cannot read property 'toLowerCase' of undefined postcss
I was using angular metronic. I got the same error and after a long time I found the wrong code block and commented...
Read more >48 answers on StackOverflow to the most popular Angular ...
Angular: Can't find Promise, Map, Set and Iterator ... Angular 4 and 5: ... EXCEPTION: TypeError: Cannot read property 'name' of null in ......
Read more >[SOLVED] Error at production build step with bundle-visualizer ...
[SOLVED] Error at production build step with bundle-visualizer: unknown: Cannot read property 'add' of undefined while minifying.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I fix the problem with: https://github.com/webpack-contrib/terser-webpack-plugin/issues/66#issuecomment-460047754
https://github.com/webpack-contrib/terser-webpack-plugin/issues/66#issue-406001469