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

Print webpack console to browser console #1063

Merged
merged 35 commits into from Sep 13, 2017

Conversation

Wernerson
Copy link
Contributor

@Wernerson Wernerson commented Aug 31, 2017

What kind of change does this PR introduce?
feature

Did you add or update the examples/?
yes

Summary
As discussed in issue #1032, the webpack console now gets displayed in the browser console if the progress option is set to true.

Does this PR introduce a breaking change?
It shouldn't ;)

Other information
None

@Wernerson Wernerson changed the title Feat/console progress Print webpack console to browser console Aug 31, 2017
@Wernerson
Copy link
Contributor Author

There were some merge issues. Will check them this weekend and make the branch ready to merge 👍

@shellscape
Copy link
Contributor

I'd also remove the clearing of the console. Best to leave that up to the users to do manually.

@codecov
Copy link

codecov bot commented Sep 2, 2017

Codecov Report

Merging #1063 into master will decrease coverage by 0.99%.
The diff coverage is 22.22%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1063   +/-   ##
=======================================
- Coverage   73.17%   72.17%   -1%     
=======================================
  Files           5        5           
  Lines         451      460    +9     
  Branches      143      147    +4     
=======================================
+ Hits          330      332    +2     
- Misses        121      128    +7
Impacted Files Coverage Δ
lib/Server.js 78.28% <22.22%> (-1.59%) ⬇️

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 d3a650f...a0fc7ad. Read the comment docs.

@Wernerson
Copy link
Contributor Author

Done and ready to merge 👍

@shellscape
Copy link
Contributor

@Wernerson please update the PR description to remove the bit about clearing the console and we'll get this merged.

lib/Server.js Outdated
@@ -52,8 +53,15 @@ function Server(compiler, options) {
const invalidPlugin = () => {
this.sockWrite(this.sockets, 'invalid');
};
const progressPlugin = new webpack.ProgressPlugin((percent, msg, addInfo) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably only load this plugin if options.progress is true as well

@Wernerson
Copy link
Contributor Author

@shellscape Condition added and description edited. Codecov fails though...

@shellscape
Copy link
Contributor

I'm going to bypass the code coverage this time. The refactor for v3 should help boost those numbers, and the config for that needs to ignore client files until we figure out a good way to test the client. Thanks for getting this in.

@shellscape shellscape merged commit ccef0d1 into webpack:master Sep 13, 2017
if (this.progress) {
const progressPlugin = new webpack.ProgressPlugin((percent, msg, addInfo) => {
percent = Math.floor(percent * 100);
if (percent === 100) msg = 'Compilation competed';
Copy link
Member

Choose a reason for hiding this comment

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

Compilation competed -> Compilation completed

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll clean up that typo in a bit

"type": "boolean"
}
]
},
Copy link
Member

Choose a reason for hiding this comment

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

"progress": {
  "description": "Shows compilation progress in browser console.",
  "type": "boolean"
 },

}
},
'progress-update': function progressUpdate(data) {
if (useProgress) log.info(`[WDS] ${data.percent}% - ${data.msg}.`);
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this super spammy?

Copy link
Contributor

Choose a reason for hiding this comment

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

given that it's an opt-in and the browser console doesn't have control characters, I don't believe it is.

@pelotom
Copy link

pelotom commented Sep 14, 2017

I was looking forward to this feature but it doesn't seem to be working, what all is needed to enable it? I set progress: true in both the dev server config and in the webpack config, but no dice. FWIW I'm using an ejected create-react-app.

@shellscape
Copy link
Contributor

@pelotom I just checked the example app for progress and it appears to be working for me.

@Wernerson
Copy link
Contributor Author

@pelotom Whats your loglevel set to? Has to be on info at least.

@g0t4
Copy link

g0t4 commented Sep 18, 2017

I'd like to use this feature but on fast builds it is super chatty, and so I disabled it and will probably forget about it when the build starts slowing down :)

How about throttle the console messages if they come in rapidly?

  • That way if the build is slow you get a good indication of progress.
  • And if the build is somewhat slow you get fewer messages.
  • And if the build is super fast you maybe see one or two of these or maybe none.

Or maybe a simple way to hook into this as a user and apply my own filtering?

@Wernerson
Copy link
Contributor Author

@g0t4 Good idea, I'll take a look into it.

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

5 participants