These are chat archives for opal/opal

27th
May 2016
Jamie Gaskins
@jgaskins
May 27 2016 01:05

@fkchang That was my thought, too. :-) There's a bit more to it than that, though. For example, if foo.rb requires bar.rb, which dynamic_requires baz.rb, this code causes a problem:

# foo.rb
require 'bar'

Bar.new.call
# bar.rb
dynamic_require('baz').then do
  class Bar
    def call
      Baz.new(self)
    end
  end
end

So you'd have to know if not only your direct dependencies, but also your indirect dependencies, have any async requires.

Earl Balai Jr
@earlbalai
May 27 2016 09:05
Anyone else having this issue on Rails 5.0.0.rc1 "activesupport-5.0.0.rc1/lib/active_support/dependencies.rb:293:in `require': cannot load such file -- rack/showexceptions (LoadError)"
Alexandr Smirnov
@JelF
May 27 2016 09:10
я fixed it in opal-rails
in january as far as i remember
Mitch VanDuyn
@catmando
May 27 2016 15:53
For react.rb I would like to include a directory inside of the react.rb gem, that would contain sources for each react.js major version.
I thought I would do it like opal-browser, where some of the files (like interval.rb) are NOT included in the base browser require, and you can then explicitly require them.
But I can't seem to get it to work.
I have the following structure:
|-lib
    |-reactive-ruby
          |- etc
    |-sources
          |-react_v13.js
          |-react_v14.js
          |-react_v15.js
    |-reactive-ruby.rb

And reactive-ruby.rb looks like this

if RUBY_ENGINE == 'opal'
  #require 'sources/react_v13.js' #comment this out for release, leave in for testing with which ever version you like
  require 'react/top_level'
  require 'react/observable'
  require 'react/component'
  require 'react/component/base'
  require 'react/element'
  require 'react/event'
  require 'react/api'
  require 'react/validator'
  require 'react/rendering_context'
  require 'react/state'
  require 'reactive-ruby/isomorphic_helpers'
  require 'rails-helpers/top_level_rails_component'
  require 'reactive-ruby/version'
else
  require 'opal'
  require 'opal-browser'
  require 'opal-activesupport'
  require 'reactive-ruby/version'
  require 'reactive-ruby/rails' if defined?(Rails)
  require 'reactive-ruby/isomorphic_helpers'
  require 'reactive-ruby/serializers'

  Opal.append_path File.expand_path('../', __FILE__).untaint
  Opal.append_path File.expand_path('../sources', __FILE__).untaint # I tried this to see if fixes anything
end

```

Mitch VanDuyn
@catmando
May 27 2016 15:59
but when I do a require 'reactive-record/sources/react_v13.js' i get:
Sprockets::FileNotFound at /
couldn't find file 'reactive-ruby/sources/react_v13' with type 'application/javascript'
As far as I can see I am following the exact structure of opal-browser, but yet can't get it to work...
any help appreciated @elia any ideas?