Hi everyone, I use TweenMax and Draggable (GSAP 1.15.0) with RequireJS for a project. My require config is :
require.config({
paths: {
TweenMax: '../../local/js-vendor/gsap/src/uncompressed/TweenMax',
Draggable: '../../local/js-vendor/gsap/src/uncompressed/utils/Draggable',
},
shim: {
Draggable: {
deps: ['TweenMax']
}
}
});
It works like expected. But i have problem during the minification step with the r.js tool. The compiler looks for the TweenLite file, but doesn't find it. I have found in this thread http://greensock.com/forums/topic/7213-using-timelinelite-and-tweenlite-with-requirejs/ that I can set the paths like this :
require.config({
paths: {
TweenMax: '../../local/js-vendor/gsap/src/uncompressed/TweenMax',
Draggable: '../../local/js-vendor/gsap/src/uncompressed/utils/Draggable',
TweenLite: 'TweenMax'
}
});
But now the error is that the TweenMax file is not found.
If I do directly
require.config({
paths: {
TweenMax: '../../local/js-vendor/gsap/src/uncompressed/TweenMax',
Draggable: '../../local/js-vendor/gsap/src/uncompressed/utils/Draggable',
TweenLite: '../../local/js-vendor/gsap/src/uncompressed/TweenLite'
}
});
it works as expected. But TweenLite is packaged two times (inside TweenMax + TweenLite directly) A workaround is exclude TweenLite with the compiler options.
requirejs: {
compile: {
options: {
paths:{
'TweenLite':'empty:'
}
}
}
}
I don’t know if there is a better way to fix the problem, but for the moment it works for me. Hope it helps. And I’m all ears if someone has a best solution.