I attempted to use the shim provided by Христо Панайотов, but I couldn't get it to work. The detailed steps for getting this to work are below; note, all these modifications are done on the same file, /node_modules/gsap/src/uncompressed/TweenMax.js
1 - first install gsap
npm install gsap
2 - add the following to the beginning of your file (* shimmed to work in browser as well):
var window = window || this
, navigator = window.navigator || { userAgent: "" }
, dummyElement = { style: {}, getElementsByTagName: function() { return [] } }
, document = document || { createElement: function() { return dummyElement } };
3 - Add the following "if" statement to the following loop, found on / near 6526.
for (p in _tweenLookup) {
a = _tweenLookup[p].tweens;
if(a && a.length) { // *** this is what I added (ends up undefined somehow).
i = a.length;
while (--i > -1) {
if (a[i]._gc) {
a.splice(i, 1);
}
}
if (a.length === 0) {
delete _tweenLookup[p]; // possible culprit: if this is an array, you should splice it!
}
}
}
4 - At the end of the file, before the main closure, add the following:
module.exports = _gsScope;
5 - How to use:
var gsap = require('gsap');
var Timelinelite = gsap.TimelineLite;
var TweenMax = gsap.TweenMax;
var Easing = gsap.Easing;
/// ect...
Here is a link to my github repo where I put my working TweenMax.js script: HERE
I wasn't able to solve the following "missing dependencies missing"; this doesn't seem to effect anything so far (tested TweenlineMax,TweenMax,Easing,etc.). The errors are:
GSAP encountered missing dependency: com.greensock.size
GSAP encountered missing dependency: com.greensock.clean
GSAP encountered missing dependency: com.greensock.byIndex
... Anyone know where these reside || how to fix it?