{"record":{"id":"e69f30d0341a1670","repo":"greensock/GSAP","slug":"please-gsap-registerplugin-scrolltrigger","errorCode":null,"errorMessage":"Please gsap.registerPlugin(ScrollTrigger)","messagePattern":"Please gsap\\.registerPlugin\\(ScrollTrigger\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ScrollTrigger.js","lineNumber":600,"sourceCode":"\t\t\t\t\tonComplete && onComplete.call(tween);\n\t\t\t\t};\n\t\t\t\ttween = getTween.tween = gsap.to(scroller, vars);\n\t\t\t\treturn tween;\n\t\t\t};\n\t\tscroller[prop] = getScroll;\n\t\tgetScroll.wheelHandler = () => getTween.tween && getTween.tween.kill() && (getTween.tween = 0);\n\t\t_addListener(scroller, \"wheel\", getScroll.wheelHandler); // Windows machines handle mousewheel scrolling in chunks (like \"3 lines per scroll\") meaning the typical strategy for cancelling the scroll isn't as sensitive. It's much more likely to match one of the previous 2 scroll event positions. So we kill any snapping as soon as there's a wheel event.\n\t\tScrollTrigger.isTouch && _addListener(scroller, \"touchmove\", getScroll.wheelHandler);\n\t\treturn getTween;\n\t};\n\n\n\n\nexport class ScrollTrigger {\n\n\tconstructor(vars, animation) {\n\t\t_coreInitted || ScrollTrigger.register(gsap) || console.warn(\"Please gsap.registerPlugin(ScrollTrigger)\");\n\t\t_context(this);\n\t\tthis.init(vars, animation);\n\t}\n\n\tinit(vars, animation) {\n\t\tthis.progress = this.start = 0;\n\t\tthis.vars && this.kill(true, true); // in case it's being initted again\n\t\tif (!_enabled) {\n\t\t\tthis.update = this.refresh = this.kill = _passThrough;\n\t\t\treturn;\n\t\t}\n\t\tvars = _setDefaults((_isString(vars) || _isNumber(vars) || vars.nodeType) ? {trigger: vars} : vars, _defaults);\n\t\tlet {onUpdate, toggleClass, id, onToggle, onRefresh, scrub, trigger, pin, pinSpacing, invalidateOnRefresh, anticipatePin, onScrubComplete, onSnapComplete, once, snap, pinReparent, pinSpacer, containerAnimation, fastScrollEnd, preventOverlaps} = vars,\n\t\t\tdirection = vars.horizontal || (vars.containerAnimation && vars.horizontal !== false) ? _horizontal : _vertical,\n\t\t\tisToggle = !scrub && scrub !== 0,\n\t\t\tscroller = _getTarget(vars.scroller || _win),\n\t\t\tscrollerCache = gsap.core.getCache(scroller),\n\t\t\tisViewport = _isViewport(scroller),","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/greensock/GSAP/blob/13e2b790546426a1a2e0e9b409f3f8dc6d6611f2/src/ScrollTrigger.js#L582-L618","documentation":"ScrollTrigger's constructor checks that the core was initialized via ScrollTrigger.register(gsap); if not it warns \"Please gsap.registerPlugin(ScrollTrigger)\". Without registration the plugin's integration with gsap core (context, refresh hooks) is not set up and behavior is unreliable.","triggerScenarios":"new ScrollTrigger({...}) or ScrollTrigger.create/gsap.timeline({scrollTrigger: ...}) without prior gsap.registerPlugin(ScrollTrigger); importing ScrollTrigger but not registering it, or registration happening after first use.","commonSituations":"Bundled apps forgetting registerPlugin after import, using useGSAP/React without registering in the bootstrap, CDN pages that load ScrollTrigger.js but never call registerPlugin, or circular imports delaying registration.","solutions":["Call gsap.registerPlugin(ScrollTrigger) at app startup before any scroll-triggered animation","In React use the useGSAP hook / register inside a module evaluated before components","For CDN, after script tags: gsap.registerPlugin(ScrollTrigger)","Combine all plugin registrations into one bootstrap module imported first"],"exampleFix":"// before\nimport { ScrollTrigger } from 'gsap/ScrollTrigger';\nScrollTrigger.create({ trigger: '.box', start: 'top center' });\n// after\nimport { gsap } from 'gsap';\nimport { ScrollTrigger } from 'gsap/ScrollTrigger';\ngsap.registerPlugin(ScrollTrigger);\nScrollTrigger.create({ trigger: '.box', start: 'top center' });","handlingStrategy":"validation","validationCode":"import { gsap } from 'gsap';\nimport { ScrollTrigger } from 'gsap/ScrollTrigger';\ngsap.registerPlugin(ScrollTrigger);\nif (!gsap.core.globals().ScrollTrigger) throw new Error('ScrollTrigger not registered');","typeGuard":null,"tryCatchPattern":"try {\n  ScrollTrigger.create(triggerVars);\n} catch (e) {\n  gsap.registerPlugin(ScrollTrigger);\n  ScrollTrigger.create(triggerVars);\n}","preventionTips":["Single bootstrap module registers gsap + all plugins","In React, register inside useGSAP or a top-level module","Verify registration before any timeline with scrollTrigger config runs"],"tags":["gsap","plugin-registration","scrolltrigger"],"backgroundTag":"missing-plugin-registration","analyzedSha":"13e2b790546426a1a2e0e9b409f3f8dc6d6611f2","analyzedAt":"2026-08-29T08:34:05.027Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}