Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

gsap/ScrollTrigger with next-transpile-modules

Recommended Posts

Hello there!

I'm using next-transpile-modules  with gsap but I'm getting some deprecated warnings/infos when I run my code.

The warning is:


"next-transpile-modules - DEPRECATED - fallbackingto previous module resolution system for module 'gsap/ScrollTriger', you can now just pass the name of the package to transpile and it will detect its real path without you having to pass a sub-module."


I have file next.config.js with code:


const withImages = require("next-images");
const withTM = require("next-transpile-modules")([
module.exports = withImages(withTM());


and I'm importing gsap and ScrollTriger like this:


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


I have tried to import it like : './ScrollTrigger' and 'gsap' and even 'ScrollTrigger' but nothing seems to work.

Hope someone knows the solution to this.

Thank you, have a nice day

Link to comment
Share on other sites

So is it working? Or you just have warnings?


The way that warning reads makes me think you just need to do this.

const withTM = require("next-transpile-modules")([


Link to comment
Share on other sites

Hi, I have tried that aswell and the warnings persist. I mean the website actually works as intended but I get a lot of these warnings which gets a bit 'messy'

Link to comment
Share on other sites



In the case of Next you need to import the file from the dist folder:

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

Happy Tweening!!!

  • Like 2
Link to comment
Share on other sites

Tried that aswell and works fine in dev mode but doesn't work in production (even when I'm considering tree shaking)

Link to comment
Share on other sites

And this is the main dist file.

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



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