dc65k Posted December 11, 2020 Share Posted December 11, 2020 Hello everyone. https://greensock.com/ npm install gsap If I install npm packages gsap I get 2.24 megabyte But https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js - 59.6 kilobyte https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/ScrollTrigger.min.js - 20.0 kilobyte Please tell me, how can I only the packages I need? For example (only I want using npm). https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js - 59.6 kilobyte https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/ScrollTrigger.min.js - 20.0 kilobyte Link to comment Share on other sites More sharing options...
elegantseagulls Posted December 11, 2020 Share Posted December 11, 2020 Hi @dc65k, Generally if you're using the NPM install, it adds the ESM and UMD files for development purposes (depending on your needs) you should not be bundling the entire package for production (what you get in production will depend on what you import into your project, and how your production bundler sets things up. The NPM folder includes the plugin files that make development easier, and shouldn't be uploaded/referenced for production. This may help further clarify things: https://greensock.com/docs/v3/Installation 3 Link to comment Share on other sites More sharing options...
GreenSock Posted December 11, 2020 Share Posted December 11, 2020 Yep, @elegantseagulls is correct. GSAP's npm package contains lots of files (UMD, ESM, and raw source versions of ALL plugins and the core plus typescript definitions, readme, etc.) and that's a GOOD thing. Please don't make the mistake of assuming that all those files will end up in your published project. Your build system should only use the individual necessary files that you import (often just the core). That'll ultimately be the same size as what you're seeing on the CloudFlare CDN when you package and minify your project. 1 Link to comment Share on other sites More sharing options...
dc65k Posted December 13, 2020 Author Share Posted December 13, 2020 Thank you very much. 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