Skip to content

[react-rails] Cannot find component for element #713

Closed
@alebian

Description

@alebian

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

Hi,

I wanted to try the gem and in development everything works fine but in production I get this error:

[react-rails] Cannot find component: 'Title' for element ...

The component is a very simpĺe one:

class Title extends React.Component {
  render() {
    return (<h1>{this.props.text}</h1>);
  }
}

I followed all the instructions in the README (added all the "requires" in files), I also read and followed other people's solutions to the same problem by adding config.react.variant = :production.

I believe that the problem comes after the assets minification. In the application.js minified I can see a Test function being defined but I think it might be in a different scope that the gem expects.

My Gemfile is this and my Gemfile.lock is this

Thanks!

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