Sha256: 27c3ca68825ad0cb40fafc11fcd3ff22875c8214419d3445fa4488c1b3df29e0
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
class Webpacker::DevServer # Configure dev server connection timeout (in seconds), default: 0.01 # Webpacker.dev_server.connect_timeout = 1 cattr_accessor(:connect_timeout) { 0.01 } delegate :config, to: :@webpacker def initialize(webpacker) @webpacker = webpacker end def running? if config.dev_server.present? Socket.tcp(host, port, connect_timeout: connect_timeout).close true else false end rescue false end def hot_module_replacing? case fetch(:hmr) when true, "true" true else false end end def host fetch(:host) end def port fetch(:port) end def https? case fetch(:https) when true, "true" true else false end end def protocol https? ? "https" : "http" end def host_with_port "#{host}:#{port}" end private def fetch(key) ENV["WEBPACKER_DEV_SERVER_#{key.upcase}"] || config.dev_server.fetch(key, defaults[key]) end def defaults config.send(:defaults)[:dev_server] || {} end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
webpacker-3.5.3 | lib/webpacker/dev_server.rb |
webpacker-3.5.2 | lib/webpacker/dev_server.rb |
webpacker-3.5.1 | lib/webpacker/dev_server.rb |
webpacker-3.5.0 | lib/webpacker/dev_server.rb |