react-email icon indicating copy to clipboard operation
react-email copied to clipboard

Attempted import error: 'convert' is not exported from 'html-to-text'

Open grmatthews opened this issue 2 years ago • 11 comments

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 avatar Jan 30 '23 03:01 grmatthews

@grmatthews there are a lot of missing things here:

  1. The dependencies have not been defined on package.json
  2. The render method has not been imported on pagefragment.jsx

zenorocha avatar Jan 30 '23 03:01 zenorocha

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.

grmatthews avatar Jan 30 '23 04:01 grmatthews

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.

zenorocha avatar Jan 30 '23 04:01 zenorocha

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'.

grmatthews avatar Jan 30 '23 04:01 grmatthews

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.

grmatthews avatar Jan 30 '23 04:01 grmatthews

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

grmatthews avatar Jan 30 '23 05:01 grmatthews

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 avatar Jan 31 '23 21:01 grmatthews

@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.

bukinoshita avatar Feb 01 '23 03:02 bukinoshita

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?

grmatthews avatar Feb 01 '23 03:02 grmatthews

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.

grmatthews avatar Feb 01 '23 03:02 grmatthews

This is what I'm getting on Sandbox CleanShot 2023-02-01 at 15 43 53@2x

bukinoshita avatar Feb 01 '23 18:02 bukinoshita