I am trying to build my solution with react-scripts but getting the following error:
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/@sendgrid/helpers/helpers/convert-keys.js:24
Read more here: http://bit.ly/2tRViJ9
What the link told me is that the sendgridib isnt compiled to ES5 and, beacause of that, it is getting an error.
What should I do?
Hello @odelucca,
It seems like there are a couple of workarounds at the link you provided that you can try while you await our solution. If you happen to get one of those workarounds working, please let us know.
Meanwhile, I have added this to our backlog. For this issue to gain priority in our backlog, we need additional +1's or a PR. When we receive a PR, that provides the biggest jump in priority.
With Best Regards,
Elmer
Same issue as @odelucca,
Hopefully a solution can be figured out very soon or SendGrid will have to be replaced with a competitor plugin in my application unfortunately....Have to be able to run React production builds...

@odelucca Did you happen to find a solution that works until this is resolved?
for @mvivonetto and everyone who is looking for a solution.
I solve that problem changing the logic of my code. Instead of trying to sending a request to sendgrid directly from the frontend (my React application) I developed a endpoint on my API (Node Koa backend) that receives the request to send an email and uses the sendgrid lib to do so. It worked and it was much more secure also.
=)
Hello @mvivonetto,
Can you try installing the latest Uglifyjs webpack plugin?
And yes, per @odelucca (thanks for helping out), if you are trying to send email through your front end, that is not recommended as you will be exposing your SendGrid API key.
With Best Regards,
Elmer
Same issue here. Has this seriously not been solved yet???
As called out by @thinkingserious, exposing your API key in the browser is a security vulnerability and should be avoided. @odelucca explained a more proper solution.
That said, I've tested against react-scripts@2 without issue, as described here.
If you simply _must_ run this in the front-end, upgrading react-scripts should resolve the issue.
Most helpful comment
@odelucca Did you happen to find a solution that works until this is resolved?