Jump to content
GreenSock

bennyboy1978

Splittext error in console - What am I doing wrong?

Recommended Posts

Hi,

I'm trying to load splittext locally so I can use in my editor but I'm get getting an error:
Uncaught SyntaxError: Unexpected token {          Line 14

Which is:   import { _gsScope, globals } from "gsap/TweenLite.js";

 

See the Pen wQwBRZ by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi @bennyboy1978 :)

 

Sounds like you're trying to use the version from the 'bonus-files-for-npm-users' folder.

 

You'll want to use the version in either the 'uncompressed' or 'minified' folders. It's in the 'utils' folder.

 

Does that fix things for you?

 

Happy tweening.

:)

 

  • Like 4
Link to comment
Share on other sites

You legend! Thanks Craig! I didn't even read "npm" durrr

 

Thanks, that was baffling me for ages!

  • Like 1
Link to comment
Share on other sites

Yep, I think @PointC is exactly right. And to be clear, the file you're using is written as an ES Module. Most modern browsers accommodate those, but you have to add type="module" to the <script> tag. It's probably easiest to just point your <script> tag's src to one of the minified files instead, which aren't ES modules (they're in plain ES5 format). 

 

Thanks for being a Shockingly Green member!

 

Happy tweening!

  • Like 3
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.
×