react.rb
react.rb copied to clipboard
LoadError `react` in production mode
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.
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
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.
This issue was moved to reactrb/reactrb#123