Android - Duplication of media assets in bundle

I am building an image heavy mobile app with Capacitor. Coming from web, I have all image assets in the public folder and load them via fetch api. When building the app in Android Studio, I noticed that all ressources are added twice in the bundle, both in

This blows up the bundle size and I am close of hitting the limit of 150 MB for the aab.
Is there a way to avoid this duplication?

Capacitor just copies whatever you have in the configured webDir, so the static/media and assets folders are probably there already.
Check you webDir and if the images are duplicated there, figure out why, it’s your build tools what’s duplicating them.

I use ionic capacitor build android --prod to build. WebDir is /build and public contains the files only once (public/assets/) before building. After running the command the media files get copied to /assets/public/static/media as well, which doubles the size of the app.

ionic capacitor build will run whatever your build command is in your package.json, or if you don’t have one I think it runs whatever the default build command is for your framework.

Which framework are you using?

I’m using React. The build command in package.json is the default one "build": "react-scripts build",