sanity-io / sanity-plugin-mux-input

An input component that integrates Sanity Studio with MUX.com video encoding/hosting service.
https://mux.com
MIT License
51 stars 55 forks source link

Issue with styled-components #325

Closed LouVerdun closed 5 months ago

LouVerdun commented 11 months ago

Hello,

I'm having an issur with styled-components and Mux Sanity plugin. I'm using Next.js 13 with an embedded Sanity setup. After installing the plugin, it throws an error in the console:

⨯ node_modules/sanity-plugin-mux-input/lib/index.js (778:18) @ eval
 ⨯ TypeError: styled_components__WEBPACK_IMPORTED_MODULE_15__ is not a function

An error is also thrown on the frontend (at least in dev mode), like so. Capture d’écran 2023-10-13 à 03 31 30

Would you have an idea on how to avoid or fix this issue? I've tried replacing imports from 'styled-components' to 'styled-components/native', as per this Stack Overflow issue.

Thank you in advance for your answer!

devanflaherty commented 11 months ago

I'm having a similar issue.

Error

node_modules/sanity-plugin-mux-input/lib/index.js (778:18) @ eval
 ⨯ TypeError: styled_components__WEBPACK_IMPORTED_MODULE_15__ is not a function
    at __webpack_require__ (/Users/devanflaherty/Developer/Alchemy/moment-studio/.next/server/webpack-runtime.js:33:43)

...

I was utilizing v2.2.3 and attempted this esmExternals: 'loose' as well, but to no avail.

"next": "^13.5.4",
"sanity-plugin-mux-input": "^2.2.3", 

After finding this issue I was able to downgrade to version 2.2.1 and my app builds successfully now. This issue mentioned a similar issue, seems they got it to work with version 2.2.1.

I can verify that pointing to 2.2.1 does get rid of the error.

stipsan commented 5 months ago

Resolved in https://github.com/sanity-io/sanity-plugin-mux-input/releases/tag/v2.3.0