Attempted import error: 'convert' is not exported from 'html-to-text'
See https://codesandbox.io/s/react-email-test-ld5jnt?file=/src/pagefragment.jsx:149-218
This sandbox contains the email component (OTPMessage.jsx) and the calling fragment (pagefragment.jsx) that causes the compile error.
Just so you know, I have copied this from an otherwise working app, so please don't comment on that my sandbox doesn't compile.
The npm installs used are at the top of OTPMessage.jsx
@grmatthews there are a lot of missing things here:
- The dependencies have not been defined on
package.json - The
rendermethod has not been imported onpagefragment.jsx
Did you even read what I read? Obviously not. The sandbox doesn't compile - it says this clearly. Yes, render is imported in my actual codebase.
How are we supposed to debug a code that doesn't compile? The whole point of creating a CodeSandbox is to have a reproducible environment.
Can you check 1st based on the error message, to see if this seems to indicate anything not being exported? I have never used sandbox before so didn't really want to have to figure it all out when perhaps this is an obvious error on your end? If you have a quick look and its not obvious I guess I can mess about with sandbox and try to figure out how it works.
./node_modules/@react-email/render/dist/index.mjs Attempted import error: 'convert' is not exported from 'html-to-text'.
So i have tried to set up code sandbox
- updated package.json
- renamed calling page to App.jsx
It still doesn't compile, unfortunately. it's complaining about ModuleNotFoundError, which people (when I google it) seem to have fixed by doing npm install @emotion/react and @emotion/styled but I have those defined in package.json, so not sure how to resolve this any further.
Let me know any next steps.
In any case you can now see the exact version of the packages I'm using.
OK, update. So the code sandbox now works, i.e. renders the email ok but my app is still giving this compile error:
./node_modules/@react-email/render/dist/index.mjs Attempted import error: 'convert' is not exported from 'html-to-text'.
I have double-checked versions, and my local npm list output has the same version numbers as those in the code sandbox.
node -v ==> v16.14.2
OK, so i've tried updating node versions to v18 for what it's worth, and that didn't make a difference either. code sandbox still works, but my app still gets this compile error:
./node_modules/@react-email/render/dist/index.mjs Attempted import error: 'convert' is not exported from 'html-to-text'.
@grmatthews Do you have a minimal reproducible repository so I can check? That would help me check and understand what's going on on your side.
I created a code sandbox that does NOT have the problem - https://codesandbox.io/s/react-email-test-ld5jnt?file=/src/pagefragment.jsx:149-218, but unfortunately, the problem still occurs in my app. Any thoughts on what could cause this?
I've just checked also. No idea what happened with the code sandbox but some of my changes seem to have been reverted. I did have react-email working fine in the code sandbox.
This is what I'm getting on Sandbox
