peter-mouland / react-lego

React-lego : incrementally add more cool stuff to your react app
http://react-lego.herokuapp.com/
MIT License
414 stars 36 forks source link

Enable es6 syntax in server code. #30

Closed ngoctranfire closed 7 years ago

ngoctranfire commented 7 years ago

Hey, So I noticed this is not really an issue of sorts, but I'm not really sure if its a quick fix or not. I want to be able to use es6 code in my server-side. That means, all that fancy spread operators, imports, etc... I noticed if I do that, when I try to do an npm start, it will fail because it won't recognize those es6 syntax. We can set it up maybe so it transpiles down first and then webpack will pick it up.

peter-mouland commented 7 years ago

hmm.. interesting. i thought it was doing that because the components use spread operators and I compile the server code using webPack (which has babel-loader).

Have you got an example of code that didn't work and i'll see if i can replicate it...

ngoctranfire commented 7 years ago

Actually. This is my error. It seems I'm trying to get react-toolbox to work with my webpack configurations and it is producing these types of errors. It's actually related to a webpack server side rendering issue. I tried using css-require-modules-hooks, but that didn't help. I went down the isomorphic webpack route and that didn't help either sadly...

peter-mouland commented 7 years ago

react-toolbox looks like a nice way to get a site started quickly. i'll have a play... at somepoint!