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

fix: show a warning if serve and --watch are used together #2375

Merged
merged 9 commits into from
Jan 31, 2021

Conversation

snitin315
Copy link
Member

@snitin315 snitin315 commented Jan 25, 2021

What kind of change does this PR introduce?
fix

Did you add tests for your changes?
yes
If relevant, did you update the documentation?
no
Summary
fixes #2370
show a warning if serve and --watch are used together

Does this PR introduce a breaking change?
No

Other information
I will work on removing --watch & --no-watch options from serve help output in next PR.

@snitin315 snitin315 requested a review from a team as a code owner January 25, 2021 06:47
@codecov
Copy link

codecov bot commented Jan 25, 2021

Codecov Report

Merging #2375 (81288b1) into master (f9ce1d3) will increase coverage by 0.74%.
The diff coverage is 83.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2375      +/-   ##
==========================================
+ Coverage   70.52%   71.26%   +0.74%     
==========================================
  Files          47       46       -1     
  Lines        2158     2158              
  Branches      563      570       +7     
==========================================
+ Hits         1522     1538      +16     
+ Misses        636      620      -16     
Impacted Files Coverage Δ
packages/webpack-cli/bin/cli.js 44.44% <33.33%> (-10.56%) ⬇️
...kages/webpack-cli/lib/utils/get-package-manager.js 61.53% <50.00%> (ø)
packages/webpack-cli/lib/utils/index.js 82.60% <82.60%> (ø)
packages/webpack-cli/lib/webpack-cli.js 91.08% <84.84%> (-0.19%) ⬇️
packages/serve/src/index.ts 84.21% <100.00%> (ø)
packages/webpack-cli/lib/bootstrap.js 100.00% <100.00%> (ø)
packages/webpack-cli/lib/index.js 100.00% <100.00%> (ø)
packages/webpack-cli/lib/plugins/CLIPlugin.js 100.00% <100.00%> (ø)
packages/webpack-cli/lib/utils/logger.js 100.00% <100.00%> (ø)
packages/webpack-cli/lib/utils/package-exists.js 100.00% <100.00%> (ø)
... and 1 more

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 ed76f9b...81288b1. Read the comment docs.

// warn user about using '--watch' with serve
if (optionName === 'watch') {
logger.warn("Do not use '--watch' with 'serve'. It has no effect.");
}
Copy link
Member

Choose a reason for hiding this comment

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

It should be inside serve command, because only servecommand know what it is unnecessary

@alexander-akait
Copy link
Member

alexander-akait commented Jan 25, 2021

Ideally we should:

  • remove --watch and --no-watch for serve and watch, so developers will not use it done
  • show warning when configuration has watch: true and set it to false to avoid Deprecation when you use serve or watch done

I think it is the best DX

@snitin315 snitin315 marked this pull request as draft January 27, 2021 10:38
@alexander-akait alexander-akait marked this pull request as ready for review January 29, 2021 17:16
@alexander-akait alexander-akait merged commit 9d6dbda into master Jan 31, 2021
@alexander-akait alexander-akait deleted the fix/serve-and-watch branch January 31, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DEP_WEBPACK_WATCH_WITHOUT_CALLBACK] error when using webpack serve with --watch flag
3 participants