Shopify / sprockets-commoner

Use Babel in Sprockets to compile JavaScript modules for the browser
MIT License
182 stars 22 forks source link

Add support for .jsx files #22

Open 3den opened 8 years ago

3den commented 8 years ago

@bouk I need this to be able to load jsx files

3den commented 8 years ago

the tests we current have seems to be very integrated so I am not sure that is the proper way to test this feature

bouk commented 8 years ago

@3den for jsx support, did you add .jsx to sprockets as an application/javascript type file? Or how are you transforming the files? I don't have a use case for .jsx as an extension myself but I'm curious how you're using them.

You'll also need to add .jsx here -> https://github.com/Shopify/sprockets-commoner/blob/master/js/babel-plugin-sprockets-commoner-internal/index.js#L254. Currently the extension support is a bit all over the place

3den commented 8 years ago

@bouk with https://github.com/reactjs/react-rails .jsx files work fine i did not had to change anything on sprockets, also if I rename the react files to .js it works fine but that is non-standard. I was able to get the client side rendering of components to work server-side is pretty buggy.

I started migrating to sprockets-commoner mostly because i wanted to use npm instead of bower, so far is being very challenging and the performance is pretty slow :(

3den commented 8 years ago

@bouk can you help me to fix this test?

bouk commented 8 years ago

@3den I'd prefer an integration test like the other tests, it's the best way to make sure it'll actually work with all the other features

Jorybraun commented 8 years ago

Any update on this?

mockdeep commented 7 years ago

As a workaround, you might be able to get away with using a .js extension and just have all .js files run through babel-preset-react.