Jump to content


error syntaxError - import { getGlobalMatrix, Matrix2D } from "./utils/matrix.js";

Recommended Posts

I have a problem that I get this error when I want to output my project.

I do not know if this problem is related to forums or not.


"next": "^11.0.0"

"react": "^17.0.2"



import { getGlobalMatrix, Matrix2D } from "./utils/matrix.js";

Link to comment
Share on other sites

Hi raana,


Next.js does not support ES Modules by default, so you'll need to import the UMD files from the dist folder.


import { gsap } from "gsap/dist/gsap";
import { Draggable } from "gsap/dist/Draggable";



  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@OSUblake hi again.

I used import {gsap} from "gsap / dist / gsap"; 

But it still has a problem.



Screenshot from 2021-11-11 21-50-38.png

Link to comment
Share on other sites

That error might be coming from server side rendering as client side scripts won't work. Try checking for a window object first like this...


if (typeof window !== "undefined") {
  gsap.registerPlugin(Draggable, InertiaPlugin);


Or register it inside an effect as those won't run server side.

useEffect(() => {
  gsap.registerPlugin(Draggable, InertiaPlugin);
}, []);


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