manifest_extensions.rb 388 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. module Webpacker::ManifestExtensions
  3. def lookup(name, pack_type = {})
  4. asset = super
  5. if pack_type[:with_integrity] && asset.respond_to?(:dig)
  6. [asset.dig('src'), asset.dig('integrity')]
  7. elsif asset.respond_to?(:dig)
  8. asset.dig('src')
  9. else
  10. asset
  11. end
  12. end
  13. end
  14. Webpacker::Manifest.prepend(Webpacker::ManifestExtensions)