From 78d9d8a73d07f3d7d035e4fb68d25feef44aaeaf Mon Sep 17 00:00:00 2001 From: Jeremy Nicoll Date: Fri, 16 Dec 2016 14:26:09 -0700 Subject: [PATCH] Uses first file in asset. Devmaps are included in Webpack 2. --- lib/hanami_webpack/manifest.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hanami_webpack/manifest.rb b/lib/hanami_webpack/manifest.rb index 452f60f..555795b 100644 --- a/lib/hanami_webpack/manifest.rb +++ b/lib/hanami_webpack/manifest.rb @@ -9,13 +9,13 @@ class Manifest def self.bundle_uri(bundle_name) raise HanamiWebpack::WebpackError, manifest['errors'] unless Hanami::Utils::Blank.blank?(manifest['errors']) - path = manifest['assetsByChunkName'][bundle_name] + path = Array(manifest['assetsByChunkName'][bundle_name]) - if Hanami::Utils::Blank.blank?(path) + if path.empty? raise HanamiWebpack::EntryPointMissingError, "Can't find entry point '#{bundle_name}' in webpack manifest" end - path = Hanami::Utils::PathPrefix.new('/').join(HanamiWebpack::Config.public_path).join(path).to_s + path = Hanami::Utils::PathPrefix.new('/').join(HanamiWebpack::Config.public_path).join(path[0]).to_s if HanamiWebpack::Config.using_dev_server? path = "//#{HanamiWebpack::Config.dev_server_host}:#{HanamiWebpack::Config.dev_server_port}#{path}"