Skip to content

Got ES6 with imports working, but prerender fails #303

Closed
@jlebensold

Description

@jlebensold

Hi there,

I've managed to get a sample app working with Flux, ES6 and the react-rails view helpers and everything is working as long as I don't try to use prerender: true in my react component:
https://github.com/jlebensold/reactadvisor/blob/master/app/views/restaurants/show.html.erb#L15

I'm using SystemJS to load my modules and have had to make my base component accessible in the root context, however it seems like ExecJS doesn't have the right JavaScript implementation for the module loader. I get this error when I set prerender: true in my component:

ExecJS::ProgramError in Restaurants#show
Error: Cannot find module 'vertx'

Is there a better way of using module imports without Browserify and Node and with react-rails?

If not, is there another module loader that I could use with Babel that will enable ES6 classes in prerendered code?

My sample project is here and can be started with a bundle and a rake db:setup in a few moments:
https://github.com/jlebensold/reactadvisor

Thanks for a great gem!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions