I want to avoid global namespace pollution by defining window.GreenSockGlobals but it causes runtime error in gsap 2.0.1:
// in webpack entry point
window.GreenSockGlobals = {}
// in webpack async chunk
import { TweenLite, Power1 } from 'gsap/all';
...
Uncaught TypeError: Cannot read property 'greensock' of undefined
at Module.<anonymous> (TweenLite.js:1962)
at Module.../../node_modules/gsap/TweenLite.js (TweenLite.js:1974)
at __webpack_require__ (bootstrap:764)
at fn (bootstrap:127)
at Module.../../node_modules/gsap/all.js (all.js:1)
at __webpack_require__ (bootstrap:764)
at fn (bootstrap:127)
Thanks for pointing that out, and sorry if it was confusing. That behavior isn't currently supported in the ES modules format, but I'll aim to add it in the next update.
I want to avoid global namespace pollution by defining
window.GreenSockGlobals
but it causes runtime error in gsap 2.0.1: