chromakode / react-html-email

Create elegant HTML email templates using React.
MIT License
896 stars 115 forks source link

Can't build with webpack 3.10 #51

Closed kopax closed 6 years ago

kopax commented 6 years ago

Hi @chromakode , I have installed and tested your library. The HTML email I receive is working. Thanks a lot for sharing your work.

I am trying to build for production with webpack and It seems that you are not transpiling your module to es2015 module.

ERROR in main.43150ac1b07aa1b9d40e.js from UglifyJs
Unexpected token: punc (() [main.43150ac1b07aa1b9d40e.js:171807,7]

That looks like to be a problem : https://github.com/chromakode/react-html-email/blob/master/.babelrc#L5

I have made and published this version that correct the plugin for browsers:

version

dpetrini commented 6 years ago

Hello,

I have same issue:

ERROR in bundle.js from UglifyJs Unexpected token: punc (() [./node_modules/react-html-email/lib/PropTypes.js:26,0][bundle.js:10137,7]

My versions:

"webpack": "^3.6.0",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-html-email": "^3.0.0",

$ node --version v6.9.4

Ok for development, issue happens in webpack build.

Thanks

kopax commented 6 years ago

@dpetrini I have found the reason of that issue, @chromakode did make that module for NodeJS.

For that, you need to check the babel target here :

https://github.com/chromakode/react-html-email/blob/master/.babelrc#L5

I have made a browser compatible version of the 3.0.0 of react-html-mail :

https://www.npmjs.com/package/react-html-email-browser

All I did was to change the target.