0

I am trying to use locomotive-scroll and gsap with my Next.js projects but I still have problems with the locomotive part. For example this adapted program works well in React, but not in Next. I commented all the locomotive lines to see at least how the program should look.

I tried adding

const withTM = require("next-transpile-modules")(["locomotive-scroll"]); module.exports = withTM({});

in the next.config.js file but it doesn't work yet.

Any help?, please.

Besides, the scroll bar styles are not been affected by the locomotive styles. I suppose due to the styles names are changed by Next.js.

Thanks in advance.

Diego
  • 41
  • 1
  • 1
  • 6
  • You need to make sure that the relevant code is ran when the client exists. Some info about this is talked about on [the GSAP install page](https://greensock.com/docs/v3/Installation) if you look for "server side". – Zach Saucier Feb 13 '21 at 22:05
  • What do you mean by "doesn't work"? Do you get any errors? – juliomalves Feb 13 '21 at 22:31
  • just uncomment all the commented lines and you will see. Gsap is working but locomotive not. – Diego Feb 13 '21 at 22:42

0 Answers0