Commit d234a872 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'sh-revert-mr-80586' into 'master'

Revert "Revert "Proxy webpack dev server in test environment""

See merge request gitlab-org/gitlab!83337
parents 618486a3 6927efac
...@@ -83,17 +83,9 @@ module WebpackHelper ...@@ -83,17 +83,9 @@ module WebpackHelper
end end
def webpack_public_host def webpack_public_host
# We do not proxy the webpack output in the 'test' environment, # We proxy webpack output in 'test' and 'dev' environment, so we can just use asset_host
# so we must reference the webpack dev server directly.
if Rails.env.test? && Gitlab.config.webpack.dev_server.enabled
host = Gitlab.config.webpack.dev_server.host
port = Gitlab.config.webpack.dev_server.port
protocol = Gitlab.config.webpack.dev_server.https ? 'https' : 'http'
"#{protocol}://#{host}:#{port}"
else
ActionController::Base.asset_host.try(:chomp, '/') ActionController::Base.asset_host.try(:chomp, '/')
end end
end
def webpack_public_path def webpack_public_path
relative_path = Gitlab.config.gitlab.relative_url_root relative_path = Gitlab.config.gitlab.relative_url_root
......
...@@ -21,7 +21,7 @@ if app.config.public_file_server.enabled ...@@ -21,7 +21,7 @@ if app.config.public_file_server.enabled
# If webpack-dev-server is configured, proxy webpack's public directory # If webpack-dev-server is configured, proxy webpack's public directory
# instead of looking for static assets # instead of looking for static assets
if Gitlab.config.webpack.dev_server.enabled && Rails.env.development? if Gitlab.config.webpack.dev_server.enabled && Gitlab.dev_or_test_env?
app.config.middleware.insert_before( app.config.middleware.insert_before(
Gitlab::Middleware::Static, Gitlab::Middleware::Static,
Gitlab::Webpack::DevServerMiddleware, Gitlab::Webpack::DevServerMiddleware,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment