-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Changes from 4 commits
53b0b29
ad45698
e1289b3
14c305b
ed6743a
81d33cf
814f66b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,9 @@ class Webpacker::Engine < ::Rails::Engine | |
end | ||
|
||
initializer "webpacker.proxy" do |app| | ||
if Rails.env.development? | ||
insert_middleware = Webpacker.config.dev_server.present? rescue nil | ||
insert_middleware ||= false | ||
if insert_middleware | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right ! thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually Webpacker.config is a Webpacker::Configuration object ; and the call to Webpacker.config.dev_server.present? leads to call the "load" method of Webpacker.config instance. |
||
app.middleware.insert_before 0, | ||
Rails::VERSION::MAJOR >= 5 ? | ||
Webpacker::DevServerProxy : "Webpacker::DevServerProxy", ssl_verify_none: true | ||
|
There was a problem hiding this comment.
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)
?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see