Skip to content

chore: warning when proxy property is undefined #3647

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

Closed
wants to merge 1 commit into from
Closed

chore: warning when proxy property is undefined #3647

wants to merge 1 commit into from

Conversation

evenstensberg
Copy link
Member

  • This is a bugfix
  • [x?] This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

No

Motivation / Use-Case

When the proxy property target is undefined, the user doesn't know, and it's nice to know its being skipped.

Breaking Changes

No

Additional Info

:)

@codecov
Copy link

codecov bot commented Aug 14, 2021

Codecov Report

Merging #3647 (b3f0be3) into master (78594da) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3647   +/-   ##
=======================================
  Coverage   93.87%   93.88%           
=======================================
  Files          15       15           
  Lines        1289     1291    +2     
  Branches      443      443           
=======================================
+ Hits         1210     1212    +2     
  Misses         72       72           
  Partials        7        7           
Impacted Files Coverage Δ
lib/Server.js 93.86% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1841c58...b3f0be3. Read the comment docs.

@@ -832,6 +832,9 @@ class Server {
if (proxyConfig.target) {
return createProxyMiddleware(context, proxyConfig);
}
this.logger.warn(
`The "target" value specified in the "proxy" property ${context} is not defined and will be skipped.`
Copy link
Member

Choose a reason for hiding this comment

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

for better visibility

Suggested change
`The "target" value specified in the "proxy" property ${context} is not defined and will be skipped.`
`The "target" value specified in the "proxy" property "${context}" is not defined and will be skipped.`

Can you also add a simple test case in https://github.com/webpack/webpack-dev-server/blob/master/test/server/proxy-option.test.js ?

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Bad idea, we should allow to use proxy without target, it is valid case

@alexander-akait
Copy link
Member

WIP on fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants