Ionic 4 GSAP - Cannot set property '_autoActivated'

I am using GSAP

I encountered this error when running ionic build --prod

Cannot set property ‘_autoActivated’ of undefined

I found, through this link, that Angular 6 and GSAP are not playing nice and that setting the following change to the angular.json file makes it work:
"buildOptimizer": false

So, great that it works but it is at a sacrifice in both total filesize (up 1mb) and more intial parsing:
563.7KiB of JavaScript is parsed during initial page load.

I would like to get past using not using buildOptimizer.

Any thoughts or previous experience with GSAP in Ionic 4 --prod and particularly this Cannot set property ‘_autoActivated’ error.

I know this is an old question, but i’ve run into the same error and spent a significant amount of time debugging it. So to spare others from the same, what solved the issue for me is to import the library from ‘gsap/all’ instead of ‘gsap’.

So instead of this:
import { TweenMax, Expo } from ‘gsap’;

You need to do this:
import { TweenMax, Expo } from ‘gsap/all’;

Here is an explanation about what’s the difference between the two imports: