reactjs / react-rails

Integrate React.js with Rails views and controllers, the asset pipeline, or webpacker.
Apache License 2.0
6.75k stars 759 forks source link

Import/Export from es6 modules #238

Closed fredericgrati closed 9 years ago

fredericgrati commented 9 years ago

Using harmony for my project is really great !! thx a lot for adding the option ;)

I still have a problem with modules. To use CommonJS module, we have to implement browserify + reactify. I found this solution a little bit overkill because we can already use ES6 who bring with him Modules.

I tried but I had this issue

So I fork the react-rails repo and add nonStrictEs6Module and es6module options. I still got an error

Exception: SyntaxError: Unexpected use of reserved word 'export'

Need some help :)

zpao commented 9 years ago

It would be helpful to see your fork and a test case.

zackify commented 9 years ago

I'm getting this same problem now, trying to figure it out

zackify commented 9 years ago

I found a way around this. Instead of exporting, I have to say window.ComponentName = ComponentName below it :/

rmosolgo commented 9 years ago

Glad you found something that works!