mrcrunchy Posted May 19, 2021 Share Posted May 19, 2021 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")([ "gsap", "gsap/ScrollTrigger", ]); 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 More sharing options...
OSUblake Posted May 19, 2021 Share Posted May 19, 2021 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")([ "gsap" ]); Link to comment Share on other sites More sharing options...
mrcrunchy Posted May 19, 2021 Author Share Posted May 19, 2021 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 More sharing options...
Rodrigo Posted May 19, 2021 Share Posted May 19, 2021 Hi, In the case of Next you need to import the file from the dist folder: import { ScrollTrigger } from "gsap/dist/ScrollTrigger"; Happy Tweening!!! 2 Link to comment Share on other sites More sharing options...
mrcrunchy Posted May 19, 2021 Author Share Posted May 19, 2021 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 More sharing options...
OSUblake Posted May 19, 2021 Share Posted May 19, 2021 And this is the main dist file. import { gsap } from "gsap/dist/gsap"; 3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now