koistya / gulp-render

Pre-render React components at compile time. E.g. SomePage.jsx -> some-page.html
MIT License
26 stars 9 forks source link

SyntaxError: Unexpected token < #5

Open cwiz opened 9 years ago

cwiz commented 9 years ago

I'm getting SyntaxError: Unexpected token < when require external modules with js extenstion and jsx syntax. How to do it properly?

cwiz commented 9 years ago

Works fine after commenting https://github.com/koistya/gulp-render/blob/master/index.js#L66

koistya commented 9 years ago

One solution is to provide a custom transform for .js files in gulpfile.js

https://github.com/kriasoft/react-starter-kit/blob/d4e624fdab5c003c60bb058846b14ae2bf0e7278/gulpfile.js#L58-L68

For example, if a filename contains /node_modules/material-ui/ then use JSX transform, otherwise use the default one.