smooth-scrolling icon indicating copy to clipboard operation
smooth-scrolling copied to clipboard

Next.js Compatibility

Open joshuatuscan opened this issue 5 years ago • 2 comments

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.

joshuatuscan avatar Feb 12 '20 16:02 joshuatuscan

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!

baptistebriel avatar Feb 12 '20 18:02 baptistebriel

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

electerious avatar Jul 28 '23 15:07 electerious