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: do not attempt hotreloading when emit is false #953

Merged
merged 1 commit into from Jun 15, 2022

Conversation

ntucker
Copy link
Contributor

@ntucker ntucker commented Jun 15, 2022

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Fixes #943

When doing SSR it is desirable to still run the same css pipeline so consistent hashes can be produced in the SSR code. However, actually emitting the CSS is unnecessary. Because of this it is custom to set emit to false. In this case, it would be nice to not have no window.document found, will not HMR CSS spamming the console as well as same some small computational time.

Breaking Changes

Additional Info

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 15, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ntucker / name: Nathaniel Tucker (94c4d25)

@@ -69,6 +69,7 @@ function hotLoader(content, context) {
function pitch(request) {
// @ts-ignore
const options = this.getOptions(/** @type {Schema} */ (schema));
const emit = typeof options.emit !== "undefined" ? options.emit : true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hoisted this so we can access it in the hot reloading path

@codecov
Copy link

codecov bot commented Jun 15, 2022

Codecov Report

Merging #953 (a2742f1) into master (31c165f) will increase coverage by 0.61%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #953      +/-   ##
==========================================
+ Coverage   89.73%   90.34%   +0.61%     
==========================================
  Files           5        5              
  Lines         828      829       +1     
  Branches      221      221              
==========================================
+ Hits          743      749       +6     
+ Misses         74       70       -4     
+ Partials       11       10       -1     
Impacted Files Coverage Δ
src/loader.js 89.01% <100.00%> (+1.80%) ⬆️
src/index.js 96.30% <0.00%> (+0.46%) ⬆️

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 31c165f...a2742f1. Read the comment docs.

@alexander-akait alexander-akait merged commit b426f04 into webpack-contrib:master Jun 15, 2022
@alexander-akait
Copy link
Member

Thank you

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.

"no window.document found, will not HMR CSS" when emit=false
2 participants