baptistebriel / smooth-scrolling

smooth scrolling and parallax effects on scroll
MIT License
612 stars 75 forks source link

Next.js Compatibility #112

Open joshuatuscan opened 4 years ago

joshuatuscan commented 4 years ago

Trying to use this in a Next.js project and get an error from simply trying to import the package.

SyntaxError: Cannot use import statement outside a module

Appears that it doesn't have Node.js-compatible source files — trying to run ES Modules in a Node.js environment.

I would love to try this out in my Next.js projects.

baptistebriel commented 4 years ago

This is weird indeed... I'm not using Next.js so I'm not sure. I guess it should support ES6 import statements. My wild guess would be to just copy the content of index.js and import it from your source files instead of npm... Sorry for not having a proper solution for now!

electerious commented 1 year ago

The package uses import but has no "type": "module" in the package.json: https://stackoverflow.com/a/64655153