Sha256: 0f47e3e32999966da96a9f2c54636ea7306fb6cdf31f70b01bc175e0ccaf51ce
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
# Same convention as manifest/configuration.rb # Loads webpacker configuration from config/webpacker.yml require "webpacker/configuration" class Webpacker::DevServer < Webpacker::FileLoader class << self def dev_server? !dev_server_values.nil? end # read settings for dev_server def hot? return false unless dev_server? if ENV["WEBPACKER_HMR"].present? val = ENV["WEBPACKER_HMR"].downcase return true if val == "true" return false if val == "false" raise new ArgumentError("WEBPACKER_HMR value is #{ENV['WEBPACKER_HMR']}. Set to TRUE|FALSE") end fetch(:hot) end def host fetch(:host) end def port fetch(:port) end def https? fetch(:https) end def protocol https? ? "https" : "http" end def file_path Webpacker::Configuration.file_path end # Uses the hot_reloading_host if appropriate def base_url "#{protocol}://#{host}:#{port}" end private def dev_server_values data.fetch(:dev_server, nil) end def fetch(key) return nil unless dev_server? dev_server_values.fetch(key, dev_server_defaults[key]) end def data load_instance if Webpacker.env.development? unless instance raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::DevServer.load_data must be called first") end instance.data end def dev_server_defaults @defaults ||= Webpacker::Configuration.defaults[:dev_server] end end private def load_data Webpacker::Configuration.instance.data end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webpacker-react-on-rails-3.0.0.rc.1 | lib/webpacker/dev_server.rb |
webpacker-react-on-rails-2.0 | lib/webpacker/dev_server.rb |