FormidableLabs / spectacle

A React-based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code.
https://commerce.nearform.com/open-source/spectacle/
MIT License
9.75k stars 691 forks source link

Bug: lib (CJS) is outputting ESM #1250

Closed royletron closed 1 year ago

royletron commented 1 year ago

Describe Your Environment

Using StackBlitz, as well as local.

Describe the Problem

I feel like I am being a complete idiot, so I respect anyone who devotes any amount of time to assist me with this but I am struggling to get anything off the ground using NextJS and Spectacle together (I know SSR is a problem, but I don't even get that far). You can see the problem on the following Stackblitz (forked their NextJS example and added the Spectacle base example on top of it)

https://stackblitz.com/edit/nextjs-xzfjyb

And I get unexpected token export. Which I know is a Module format problem, but I can't make it work whatever I throw at it!

ryan-roemer commented 1 year ago

Oh my, you have indeed discovered a much larger issue -- our lib output is supposed to be CommonJS, but is published as ESM! See, e.g. https://unpkg.com/browse/spectacle@9.6.0/lib/index.js

ryan-roemer commented 1 year ago

@royletron https://github.com/FormidableLabs/spectacle/pull/1251 is out for evaluation if you want to kick the tires. Not sure about all the Next13 stuff, but this should avoid the export issue as lib/index.js should now be correctly CommonJS.

divideby0 commented 1 year ago

I'm running into the same issue trying to incorporate Spectacle into a Next.js 13 project. It looks like the fix was merged earlier this year but there hasn't been a release since Sept of last year (9.6.0). Is there a pending release with this fix or is the best solution to fork the main branch and issue a release on from another npm org for now?