Jump to content
Search Community

GSAP/Flip Plugin with NodeJs/Express server.

rashonwill test
Moderator Tag

Recommended Posts

I'm have a nodejs - express server and trying to use the Flip plugin. I get this error below whenever I run my server and I've required it on my route.

 

ReferenceError: document is not defined.

Desktop/Fari Backend/fari_backend/node_modules/gsap/dist/Flip.js:1222
            _setDoc(document.body);

 

 

const { gsap } = require("gsap/dist/gsap");
const { Flip }= require("gsap/dist/Flip");
 
gsap.registerPlugin(Flip);

 Not sure how to solve this, as I've followed all instructions.

 

Link to comment
Share on other sites

Hi rashonwill,

 

Where exactly are you putting those require statements? It sounds like you are running that code inside a JS file that executes server side, instead of client side. On top of that, require will not work client side unless you use some type of bundler to transform it. Parcel might be a good one to look into using as it provides middleware to use with an express server.

https://parceljs.org/

 

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