Sha256: 1e3273d58b919a221d176c4b36d71e7162bf3a2e57acad4c1b213f59b521a212
Contents?: true
Size: 1.34 KB
Versions: 5
Compression:
Stored size: 1.34 KB
Contents
# frozen_string_literal: true require 'sewing_kit/webpack/manifest/base' module SewingKit module Webpack class Manifest class Development < Base def initialize super @metadata_path = nil end def clear_cache! super @metadata_path = nil end def metadata load_metadata end def load_metadata begin return load_metadata_from_fs(@metadata_path) if @metadata_path rescue => e Rails.logger.warn "[sewing_kit] could not read manifest from #{@metadata_path}; falling back to node. #{e}" @metadata_path = nil end result = SewingKit::Webpack::Manifest::Base.load_metadata_from_node raise LegacyManifestError, result unless result['entrypoints'] || result['development'] @metadata_path = result && result['path'] result end def load_metadata_from_fs(path) begin json_str = File.read(path) rescue => e raise ManifestLoadError.new(path, e) end begin JSON.parse(json_str) rescue => e raise ManifestParseError, e end end protected def mode 'development' end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems