wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

Browserify build error #186

Closed davenlin19 closed 8 years ago

davenlin19 commented 8 years ago

I've got an error: "Browserify Error: ParseError: Unexpected token" when building by Babel and Browserify. How could i fix that ?

Hello.rc <div>Test</div> ^ ParseError: Unexpected token

.babelrc { "presets": ["es2015", "react"] }

Thanks

nippur72 commented 8 years ago

perhaps it's because of the missing div close? (</div>)

davenlin19 commented 8 years ago

Sorry, i have the div close in my code. It's not the problem.

nippur72 commented 8 years ago

I think you have some misconfiguration in your build pipeline, it's like you are trying to compile the .rt file as a JavaScript file.

Don't know much of Browserify (I'm a Webpack guy), you have to make sure that .rt files are processed by react-templates and the result is added to the bundle.

Also, unless you use --modules ES6, the output from react-templates doesn't need to be transpiled because it's already ES5.

davenlin19 commented 8 years ago

Thank you, by adding transform: ['react-templatify'] into browserify's config. It works.