hyperbrew / bolt-uxp

A lightning-fast boilerplate for building Adobe UXP Plugins in React, Svelte or Vue built on Vite + TypeScript + Sass
MIT License
29 stars 3 forks source link

Using @swc-react/* packages with bolt-uxp #10

Open RethinkFlash opened 3 months ago

RethinkFlash commented 3 months ago

Just wanted to bring this to attention, as the @swc-react looks promising and would be nice to use in a bolt-uxp react project, but using any of the @swc-react packages results in an error: Uncaught ReferenceError: exports is not defined

Reading up on the main README.md file on this github repo, it is stated that "Recently the Adobe UXP team is moving away from the built-in Spectrum UXP to Spectrum Web Components."

Looking more into using Spectrum Web Components, you would normally add the package, such as "@spectrum-web-components/action-button" to use an action button.

Without defining a definition in the globals.d.ts, typescript will of course complain. But having a premade typed definition for specific components is really nice to have.

It looks like Adobe has created nice wrappers for each of these spectrum components (has supposably has support for Next.js). The documentation page can be found over here -> https://opensource.adobe.com/spectrum-web-components/using-swc-react/

However stated at the beginning, anytime any of the @swc-react packages are imported, it results in the exports is not defined error.

I could be missing a crucial step that I may have missed, but I haven't found anything clear to resolve this issue.