ricky11 Posted June 26, 2021 Share Posted June 26, 2021 I am importing gsap as so : const {default : gsap} = import(/* webpackChunkName: "gsap" */ 'gsap/dist/gsap.min.js') this is great because i don't need to load the 60kb gsap build on every load, and only when and if its needed. The problem however is that I am only using one simple tween function to animate numbers going from 0 to 100. Can I tree shake gsap code to tween only ? 60 kb does seem like a lot for what i am doing? thanks. Link to comment Share on other sites More sharing options...
OSUblake Posted June 26, 2021 Share Posted June 26, 2021 Hi ricky11! You can import just the core for a smaller a bundle. Not sure how big it is, but give this a try. Note that there is no UMD version of it. import { gsap } from "gsap/gsap-core"; 1 Link to comment Share on other sites More sharing options...
GreenSock Posted June 27, 2021 Share Posted June 27, 2021 Also, it's not 60kb. It's closer to 20kb gzipped And keep in mind that it only has to load once and then it's "free" on every page thereafter due to caching. You might want to read this: Happy tweening! 1 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