Share Posted May 18, 2016 Hi, I have a problem using gsap through bower, compiled with webpack. My shim looks like this: webpack: { defaults: { plugins: [ new webpack.ProvidePlugin({ ... '$': 'jquery', 'TweenLite': 'gsap' ... }) ], externals: { jquery: 'window.jQuery', 'TweenLite': 'gsap' } } } Everything works just fine when my project is not minified / compiled to build-version, where I end up getting this error message: Uncaught TypeError: Cannot set property 'gsClass' of undefined It works perfect when developing, even though it's run through an entry, main.js... Very confusing. Anyone had this problem before? Link to comment Share on other sites More sharing options...
Share Posted May 18, 2016 That is pretty weird indeed. Never heard of anything like that before. I looked at the code too and can't figure out why in the world an error like that could possibly get thrown. [scratching head] Can you provide detailed instructions about how to reproduce the issue (including what needs to be installed, where, etc.)? I don't use bower nor webpack, so I may need some hand-holding. By the way, TweenMax is considered the "main" file for the "gsap" package, not TweenLite. That probably has nothing to do with these errors though. 1 Link to comment Share on other sites More sharing options...
Share Posted May 24, 2016 Have you tried... externals: { jquery: 'window.jQuery', 'TweenLite': 'TweenLite' } 2 Link to comment Share on other sites More sharing options...
Author Share Posted May 25, 2016 Hi, been busy building more and haven't had a chance to follow up on this. I found the problem, it would be nice is someone with more webpack / node skills than me could verify. It all has to do with the webpack UglifyJsPlugin, and the setting "pure_getters". When having this set to true, I get the error. There's no impact on .js size in the end, so I just removed the property. But I cannot give any explanation to what lies beneath this problem. 2 Link to comment Share on other sites More sharing options...
Share Posted May 26, 2016 For the record, GSAP 1.18.5 has some improvements for compatibility with Webpack/NPM/Browserify/Node. It was released today. You might want to give that a try. Link to comment Share on other sites More sharing options...
Share Posted January 28, 2017 Upgrading to Webpack 2.2 from Webpack 1 and found the same issue. Thanks for sharing the fix @Torrfura Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now