lukePeavey / SplitType

Javascript utility that splits text into lines, words, characters for animation
https://lukepeavey.github.io/SplitType/
558 stars 40 forks source link

Not working with react next js #13

Closed trompx closed 3 years ago

trompx commented 3 years ago

Hello,

I was using an old version of splittype and recently migrated to next js. I tried to use your new version import SplitType from 'split-type' but I get the following error:

Server Error
SyntaxError: Unexpected token 'export'

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
external%20%22split-type%22 (1:0) @ eval

> 1 | module.exports = require("split-type");

Any idea how to solve this?

lukePeavey commented 3 years ago

Did you install the latest version of split-type?

lukePeavey commented 3 years ago

@trompx sorry it took me a few days to respond

Just tested split-type with Next js, I am getting the same error.

lukePeavey commented 3 years ago

I just released a patch version v0.2.5 that fixes this issue.

I've tested it with Next JS and it seems to be working fine now. Here is a CodeSandbox Example with next and split-type@0.2.5.

lukePeavey commented 3 years ago

I'm going to close this now since it's been resolved.

@trompx I'm not sure if you saw my previous comment, but this issue was fixed in version 0.2.5. Once you upgrade to the new version, SplitType should work fine with Next.js. If you are still having problems after upgrading to 0.2.5, let me know and I'll reopen this.

trompx commented 3 years ago

So sorry for answering this late, I've been caught by other projects. It works wonder now, no more errors, thanks !

lukePeavey commented 3 years ago

Great, glad to hear it!