Ionic JavaScript Obfuscation

I found the solution, you need to change the line to the scripts section of package.json from:

...
  "scripts": {     
    "capacitor:copy:after": "npx javascript-obfuscator www --output www --self-defending true"
  }

To

    ...
  "scripts": {     
    "ionic:build:after": "npx javascript-obfuscator www --output www --self-defending true"
  }