class Webpacker::Manifest

def lookup(name, pack_type = {})

def lookup(name, pack_type = {})
  compile if compiling?
  # When using SplitChunks or RuntimeChunks the manifest hash will contain
  # an extra object called "entrypoints". When the entrypoints key is not
  # present in the manifest, or the name is not found in the entrypoints hash,
  # it will raise a NoMethodError. If this happens, we should try to lookup
  # a single instance of the pack based on the given name.
  begin
    manifest_pack_type = manifest_type(pack_type[:type])
    manifest_pack_name = manifest_name(name, manifest_pack_type)
    # Lookup the pack in the entrypoints of the manifest
    find("entrypoints")[manifest_pack_name][manifest_pack_type]
  rescue NoMethodError
    # Lookup a single instance of the pack
    find(full_pack_name(name, pack_type[:type]))
  end
end