class Opal::Environment

do this for you.
If you are running rails, then you just need opal-rails instead, which will
directory to our load path to use real gems inside your opal environment.
that have opal load paths ready to use. You can also add an existing gem’s lib
load paths loaded. This makes it easy for stand-alone rack apps, or test runners
Environment is a subclass of Sprockets::Environment which already has our opal

def initialize *args

def initialize *args
  super
  Opal.paths.each { |p| append_path p }
end

def use_gem gem_name

def use_gem gem_name
  append_path File.join(Gem::Specification.find_by_name(gem_name).gem_dir, 'lib')
end