Jump to content
Search Community

ScrollTrigger

xlixelit test
Moderator Tag

Recommended Posts

Good afternoon,

 

When I am in development mode everything works fine.  But in build/production I get this:

 

Invalid property scrollTrigger set to Objectend: "bottom bottom"scrub: 2start: "-50px top"trigger: ".scrollDist"__proto__: Object Missing plugin? gsap.registerPlugin()

 

This is my code I have written:

gsap.timeline({scrollTrigger:{trigger:'.scrollDist', start:'-70px top', end:'bottom bottom', scrub:2}})

 

Not too sure why it runs fine in dev but not in build?

 

Many thanks

 

Joel

Link to comment
Share on other sites

This is my import etc, using VUE if that matters to anyone.

 

import gsap from "gsap";
import { ScrollToPlugin } from "gsap/ScrollToPlugin";
import { ScrollTrigger } from "gsap/ScrollTrigger";
 
gsap.registerPlugin( ScrollTrigger, ScrollToPlugin );
Link to comment
Share on other sites

Welcome to the forums, @xlixelit!

 

It definitely sounds like an issue with your build system because that error means that ScrollTrigger is not loaded or registered. But clearly your code that you shared is importing ScrollTrigger and registering it. 

 

It's quite difficult to troubleshoot blind, but maybe your build tool is being way too aggressive with tree shaking and it's dumping ScrollTrigger when obviously it's shouldn't be(?) That's actually one of the purposes of gsap.registerPlugin() - it forces you to reference the plugins in your own code so that it WON'T get dumped by tree shaking. So I have no idea why your environment is doing that. 

Link to comment
Share on other sites

Are you using nuxt? If so, I would try to transpile gsap.

 

Or try using the umd files. Some frameworks aren't configured to consume es modules.

import { ScrollToPlugin } from "gsap/dist/ScrollToPlugin";
import { ScrollTrigger } from "gsap/dist/ScrollTrigger";

 

 

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...