Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Uses first file in asset. Devmaps are included in Webpack 2. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/hanami_webpack/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down