opal/zeitwerk/loader.rb in opal-zeitwerk-0.0.3 vs opal/zeitwerk/loader.rb in opal-zeitwerk-0.0.4

- old
+ new

@@ -1,7 +1,5 @@ -# frozen_string_literal: true - require "set" require "securerandom" module Zeitwerk class Loader @@ -523,10 +521,10 @@ # @return [void] def set_autoload(parent, cname, abspath) # $LOADED_FEATURES stores real paths since Ruby 2.4.4. We set and save the # real path to be able to delete it from $LOADED_FEATURES on unload, and to # be able to do a lookup later in Kernel#require for manual require calls. - realpath = File.realpath(abspath) + realpath = `Opal.modules.hasOwnProperty(abspath)` ? abspath : File.realpath(abspath) parent.autoload(cname, realpath) autoloads[realpath] = [parent, cname] Registry.register_autoload(self, realpath)