Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-portable-text has no property 'toPlainText" #70

Closed
parkerhutchinson opened this issue Jul 21, 2023 · 4 comments · Fixed by portabletext/to-html#22 or #81
Closed

react-portable-text has no property 'toPlainText" #70

parkerhutchinson opened this issue Jul 21, 2023 · 4 comments · Fixed by portabletext/to-html#22 or #81

Comments

@parkerhutchinson
Copy link

parkerhutchinson commented Jul 21, 2023

when building my site Im running into this error both locally and during deployments to vercel.

--
10:34:43.698 |  
10:34:43.699 | 1 \| import cjs from './react-portable-text.js';
10:34:43.699 | 2 \|
10:34:43.699 | > 3 \| export const toPlainText = cjs.toPlainText;
10:34:43.699 | \|                            ^
10:34:43.699 | 4 \| export const PortableText = cjs.PortableText;
10:34:43.699 | 5 \| export const defaultComponents = cjs.defaultComponents;
10:34:43.699 | 6 \| export const mergeComponents = cjs.mergeComponents;
10:34:43.699 |  
10:34:43.699 |  
10:34:43.699 | WebpackError: TypeError: Cannot read properties of undefined (reading 'toPlain  Text')
10:34:43.699 |  
10:34:43.699 | - react-portable-text.cjs.mjs:3
10:34:43.699 | [retool-dot-com]/[@portabletext]/react/dist/react-portable-text.cjs.mjs:3:28
10:34:43.700 | - bootstrap:19
10:34:43.700 | retool-dot-com/webpack/bootstrap:19:1
10:34:43.700 |  
10:34:43.700 | - pageSanity.js:9
10:34:43.700 | retool-dot-com/src/templates/pageSanity.js:9:9

CleanShot 2023-07-21 at 11 05 23

It makes it seem like this would be the dep packages issue but when using react-portable-text directly there is no issue. it builds and runs perfectly. there is something about the implementation or version of this package in your package that causes these errors.

Gatsby v4.x
node v16.x
babel/core v7.6

tested this on your package from version 2.0.3 -> 3.0.4 all resulted in the same error.
simply installing react-portable-text directly and only replacing the props of that component to be serializers and content this builds and runs with no issues.

@zachgoll
Copy link

Is there a workaround to this?

I'd like to use this module without forking as it's the recommended way by Sanity, but this error is causing all builds to fail.

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 3.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stipsan
Copy link
Member

stipsan commented Aug 23, 2023

@parkerhutchinson or @zachgoll can either of you confirm if it's resolved in v3.0.7?

@stipsan stipsan reopened this Aug 23, 2023
@stipsan
Copy link
Member

stipsan commented Aug 25, 2023

Unable to reproduce this error anymore on our end, so I'm closing the issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants