ably / spaces

The Spaces SDK enables you build collaborative spaces for your application and enable features like Avatar stack, Live cursors, Member location, Component locking and more.
https://space.ably.dev/
Apache License 2.0
43 stars 7 forks source link

Not able to run React Hooks example for Spaces in NextJS 14 app #306

Closed pradelkai closed 4 months ago

pradelkai commented 6 months ago

Just following the Hook install tutorial results in an ESM error: Error [ERR_REQUIRE_ESM]: require() of ES Module ...node_modules/@ably/spaces/node_modules/nanoid/index.js from ...node_modules/@ably/spaces/dist/cjs/SpaceUpdate.js not supported.

Any way to get around this?

MaksymZup commented 5 months ago

for me worked import Spaces from '@ably/spaces/dist/mjs'; instead of documentation import of Spaces

ttypic commented 4 months ago

Hi @pradelkai and @MaksymZup, thank you for bringing this to our attention and providing the workaround. It appears to be a bug in the CommonJS version of the SDK. We are currently working on a fix for this. Right now, there are two workarounds:

VeskeR commented 4 months ago

This has been fixed in https://github.com/ably/spaces/pull/307 PR and will be released in the next patch version for Spaces SDK.

VeskeR commented 4 months ago

Hi @pradelkai , @MaksymZup !

This issue has been fixed in 0.3.1 Spaces SDK release.

pradelkai commented 4 months ago

Thank you. Much appreciated.

Kai

On Fri, May 3, 2024 at 8:20 AM Andrew Bulat @.***> wrote:

Hi @pradelkai https://github.com/pradelkai , @MaksymZup https://github.com/MaksymZup !

This issue has been fixed in 0.3.1 https://github.com/ably/spaces/releases/tag/0.3.1 Spaces SDK release.

— Reply to this email directly, view it on GitHub https://github.com/ably/spaces/issues/306#issuecomment-2092907099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYUOPHF75G5GHMLQDGPPHXDZAN6JBAVCNFSM6AAAAABEYGDLK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJSHEYDOMBZHE . You are receiving this because you were mentioned.Message ID: @.***>