Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadError react in production mode #123

Open
olegantonyan opened this issue Jan 30, 2016 · 3 comments
Open

LoadError react in production mode #123

olegantonyan opened this issue Jan 30, 2016 · 3 comments

Comments

@olegantonyan
Copy link

Whe I run my app in production mode (either on localhost with -e production or on a real server) I get an error:

shared/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require': No such file to load -- react (LoadError)

If I remove require 'react' from app/react/components.rb than I get another error:

app/react/models.rb:2:in `<top (required)>': undefined method `require_tree' for main:Object (NoMethodError)

And so forth. So, obviously something is going wrong here.
With config.eager_load = false in production.rb this error disappear, but this is not a solution.
In development everything is fine.

@olegantonyan
Copy link
Author

https://github.com/olegantonyan/test_reactive_record - this is a fresh rails4 app with this issue.
Run it in production:

SECRET_KEY_BASE='bf4381777807529317115a8d854a48bc08d3029a82ac5cfd432c19384f8cd628350e00c24b81001dfad852741dc3995bc7b972946571918567bb2f0b21cfefc7' bundle exec rails server -e production

Any ideas will be very helpful. I cannot solve this by myself

@loicboutet
Copy link

Hey,

I solved the issue with @olegantonyan on the gitter.
The problem comes from the config generated by the generator. In production all files are preloaded so the ruby manifests raise errors when interpreted as normal ruby files.
Adding to those file will solve the problem :

if RUBY_ENGINE == 'opal'
  ...
end

I will update the generator to take that into account shortly.

Important to note, the first rake command in production takes a long time to solve... I'm not sure why, but that does not seem to be blocking for the moment.

@sollycatprint
Copy link

This issue was moved to ruby-hyperloop/hyper-react#123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants