greensock / GSAP

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
https://gsap.com
19.56k stars 1.72k forks source link

Usage of window.GreenSockGlobals breaks TweenLite #273

Closed filmic closed 6 years ago

filmic commented 6 years ago

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)
jackdoyle commented 6 years ago

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.

jackdoyle commented 6 years ago

Should be resolved in 2.0.2