@Friebel I read your post, but I don't know what you're doing.
Check out this example repo. It will generate a visual comparison of the two bundles.
https://github.com/OSUblake/gsap-treeshaking
npm install
npm run build
Using "gsap"
Parsed size: 118.73 KB
Gzipped size: 38.19 KB
Using "gsap/all"
Parsed size: 55.46 KB
Gzipped size: 16.63 KB
It could be even smaller, but the unused eases aren't being dropped. Maybe in the next version.
@Gordon Freeman you may want to have a look at that repo too.
To install bonus plugins like the MorphSVGPlugin, look at the folder you download from your account. The latest version finally has a package.json file, but it's still not ideal. Copy the files in the bonus-files-for-npm-users folder to the esm folder, and then uncomment this in the all.js file.
/*
import DrawSVGPlugin from "./DrawSVGPlugin.js";
import MorphSVGPlugin from "./MorphSVGPlugin.js";
import Physics2DPlugin from "./Physics2DPlugin.js";
import PhysicsPropsPlugin from "./PhysicsPropsPlugin.js";
import ScrambleTextPlugin from "./ScrambleTextPlugin.js";
import ThrowPropsPlugin from "./ThrowPropsPlugin.js";
import GSDevTools from "./GSDevTools.js";
import SplitText from "./SplitText.js";
import CustomBounce from "./CustomBounce.js";
import CustomEase from "./CustomEase.js";
import CustomWiggle from "./CustomWiggle.js";
export {
DrawSVGPlugin,
MorphSVGPlugin,
Physics2DPlugin,
PhysicsPropsPlugin,
ScrambleTextPlugin,
ThrowPropsPlugin,
GSDevTools,
SplitText,
CustomBounce,
CustomEase,
CustomWiggle
}
*/
Now install that esm folder in your project.
DO NOT INSTALL GSAP FROM NPM!!!
How to install from a folder or other location
https://docs.npmjs.com/cli/install
Or you can create a symlink, and keep reusing the same folder for other projects.
https://docs.npmjs.com/cli/link
Now import from there, and you should be good.
import {
TweenMax,
TimelineMax,
AttrPlugin,
CSSPlugin,
MorphSVGPlugin
} from "gsap/all";
// Ensure modules don't get dropped by tree-shaking
const activated = [
TweenMax,
TimelineMax,
AttrPlugin,
CSSPlugin,
MorphSVGPlugin
];