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

Automatically add the HMR plugin when hot or hotOnly is enabled #1612

Merged
merged 1 commit into from Dec 27, 2018

Conversation

glenjamin
Copy link
Contributor

  • This is a bugfix
  • 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?

Yep, tests added.

Motivation / Use-Case

When setting the hot or hotOnly option, the entries are added automatically, but the HMR plugin needs to be added into config by the user.

This PR extends the existing addEntries module to also amend the plugins config. This does make the name a bit of a misnomer, but for now i've just done the minimal changes.

Breaking Changes

This is arguably a breaking change, as it's modifying config that it wasn't before. But if you were passing hot or hotOnly and missing the plugin, you were doing something wrong - and I've put in some logic to prevent duplicates of the HMR plugin.

I think it could be argued that this is safe to put into a point release.

Additional Info

This overlaps somewhat with functionality implemented in webpack-cli/bin/convert-argv, that adds the webpack HMR plugin if you specifiy --hot, but not if you specify --hot-only.

@codecov
Copy link

codecov bot commented Dec 26, 2018

Codecov Report

Merging #1612 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1612      +/-   ##
==========================================
+ Coverage   74.07%   74.12%   +0.04%     
==========================================
  Files          10       10              
  Lines         679      684       +5     
==========================================
+ Hits          503      507       +4     
- Misses        176      177       +1
Impacted Files Coverage Δ
lib/utils/addEntries.js 100% <100%> (ø) ⬆️
lib/Server.js 81.01% <0%> (-0.27%) ⬇️

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 4b7a828...e476464. Read the comment docs.

Copy link
Member

@evenstensberg evenstensberg left a comment

Choose a reason for hiding this comment

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

lgtm

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.

Good work

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.

None yet

3 participants