Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable devserver proxy for custom environments #1415

Merged
Merged
2 changes: 1 addition & 1 deletion lib/webpacker/dev_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ def fetch(key)
end

def defaults
config.send(:defaults)[:dev_server]
config.send(:defaults)[:dev_server] || {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about config.dig(:defaults, :dev_server)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config is not a hash, but a Webpacker::Configuration which has a 'defaults' private method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see

end
end
3 changes: 2 additions & 1 deletion lib/webpacker/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class Webpacker::Engine < ::Rails::Engine
end

initializer "webpacker.proxy" do |app|
if Rails.env.development?
insert_middleware = Webpacker.config.dev_server.present? rescue nil
if insert_middleware
app.middleware.insert_before 0,
Rails::VERSION::MAJOR >= 5 ?
Webpacker::DevServerProxy : "Webpacker::DevServerProxy", ssl_verify_none: true
Expand Down