So I was excited to notice that the recently released version 1.19.0 promised to finally bring us support for ES6 Imports, as this would be greatly helpful for my current project, which is using Webpack and Babel.
I am trying to only import the bare minimum, as I'm a bit of a optimisation nut job. Based off the fragmented information I can find scattered between here and github, I should be able to import the modules using either of the following syntax.
import { TweenLite } from 'gsap';
or
import TweenLite from 'TweenLite'; // Alias added in Webpack config
And that all seems to be working... sort of. There just seems to be some rather odd behaviour happening:
If I import { TweenLite } from 'gsap', I get this error upon trying TweenLite.fromTo():
Uncaught TypeError: Cannot read property 'fromTo' of undefined
If I import TweenLite from 'TweenLite', I get this error upon trying TweenLite.fromTo():
Uncaught TypeError: u.default.fromTo is not a function
If I import TweenMax from 'TweenLite', I get no errors upon trying TweenLite.fromTo().
If I import { TweenMax } from 'gsap', I get no errors upon trying TweenLite.fromTo().
If I import { TweenLite } from 'gsap', I get no errors upon trying TweenMax.fromTo().
If I import TweenMax from 'TweenLite', I get the following errors upon trying TweenMax.fromTo().
Uncaught TypeError: u.default.fromTo is not a function
If I import { TweenMax } from 'gsap', I get the following errors upon trying TweenMax.fromTo().
Uncaught TypeError: Cannot read property 'fromTo' of undefined
Generally, completely bloody confusing.
What's more, when importing from 'gsap', the files always come out at 185kb, regardless of what's imported. When I try importing from TweenLite, the files always come out at 101kb, regardless of what's imported. This doesn't seem quite right to me either.
I'd really appreciate some help to figure out what is happening here, otherwise I think I'm running a severe risk of early-onset baldness from all this hair-pulling!
Thanks in advance