Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ionic v4] Build with --prod flag produces -> TypeError: Cannot read property 'minify' of undefined #17367

Closed
H4ad opened this issue Feb 2, 2019 · 6 comments
Labels

Comments

@H4ad
Copy link

H4ad commented Feb 2, 2019

Bug 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
@ionitron-bot ionitron-bot bot added the triage label Feb 2, 2019
@grantperry
Copy link

grantperry commented Feb 3, 2019

webpack-contrib/terser-webpack-plugin#66 (comment)

@almothafar
Copy link

Look at workarounds here:
terser/terser#254 (comment)

@H4ad
Copy link
Author

H4ad commented Feb 3, 2019

I fix the problem with:
webpack-contrib/terser-webpack-plugin#66 (comment)

@brandyscarney
Copy link
Member

The build command is from Angular, this seems to be a problem with the terser version. Here's an Angular CLI issue for it, please follow the bug here: angular/angular-cli#13582.

@brandyscarney
Copy link
Member

I am going to close this as it looks like the linked issue has been fixed, thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented May 11, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants