How to obfuscate / uglify PWA code

We have built several Ionic/Angular apps as native apps in the App Stores, and now we are about to publish our first Ionic/Angular PWA (Ionic 6). We’ve posted dev & test versions to our cloud hosting location and tested on multiple devices. So far so good. But, unlike the native apps, when I do ‘ionic build --prod’ the resulting output files still contain all of our comments and console.log messages. Those are all visible if someone runs the app from a regular web-browser. How can we get rid of all those messages and comments in a true production build?

The --prod flag in theory should take care of that. Do you have a config somewhere that changes that behavior? You could also try adding the --release flag.

Though if you’re deploying it as a normal webapp, there’s a chance you’re not even using the Ionic CLI to build it on your host.

Thanks, but I’m currently using those flags. My understanding, which may be wrong, is that those apply for a build of a native app that gets installed via the app stores. I’m wanting to distribute as a PWA. When I build my PWA app with --prod and --release, I can still see and understand more of the source code than I want to, using dev tools in the browswer. I know that a PWA is less secure in this regard than a native app, but I was hoping for more of it hidden than it is. All my ‘console.log’ messages are still in the code. I can manally remove them with a global search/replace, but I was hoping to avoid that step, if I can.