Jump to content
Search Community

Scrolltrigger not usable on CodeSandbox with NextJS template?

omarel test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

I'm trying to setup a Scrolltrigger demo in React/NextJs to get some assistance on the forums, but ScrollTrigger doesn't seem to even load on CodeSandbox using CodeSandbox's NextJs template:

 

Per the Greensock docs for CodeSandbox I installed gsap and gsap-trial, but I keep getting this error on CodeSandbox

 

SyntaxError: Unexpected token 'export'

Please see here:

https://codesandbox.io/s/black-tdd-rncum0?file=/components/bigphoto.js

Link to comment
Share on other sites

10 hours ago, OSUblake said:

NextJS does not support ES Modules so you'll need to use the UMD files located in the dist folder.

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

 

 

Thank you! That worked.

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...