-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
cannot mute webpack/hot/dev-server console.logs #4115
Comments
It looks like you just deleted our lovely crafted issue template. It was there for good reasons. Please help us solving your issue by answering the questions asked in this template. I'm closing this. Please either update the issue with the template and reopen, or open a new issue. |
@sokra boo, im afraid i dont have th power to reopen the issue updated the issue based on the template for ppl who dont wanna wait just copy those 2 files, comment out the relevant console.logs and reference ur own |
I'd like to work on this! |
+1 will do a code review |
What is the difference* between the HotModuleReplacementPlugin and the devServer.hot flag? |
@LucianoGraziani webpack/webpack-dev-server#97 (comment) |
Thank you @tsm91! I never really understood HRM hah. I thought that just adding the plugin will work 🙈 |
Another hacky temp solution for now in case you do not want to copy the needed files and reference them instead of webpack's files (so you'll still get updates in case they'll come in future versions): ////////// Temp solution ///////////
// TODO - Disable all info / logs for HMR until the log level issue will be fixed - https://github.com/webpack/webpack/issues/4115
const replaceInFile = (filePath, searchRegex, replaceString) => {
const fs = require('fs');
filePath = path.resolve(filePath);
fs.readFile(filePath, 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
const result = data.replace(searchRegex, replaceString);
fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) {
return console.log(err);
}
});
});
};
// Why do we add `;\n{}`? Some part of the code has if conditions without {} around their content.
// So we'll just comment out the console.log line we'll get an error. This way we're adding a line that doesn't do anything.
const emptyStatement = '//$1;\n{}';
const consoleRegex = /(console\.(info|log).+\);)/g;
replaceInFile("node_modules/webpack/hot/dev-server.js", consoleRegex, emptyStatement);
replaceInFile("node_modules/webpack/hot/log-apply-result.js", consoleRegex, emptyStatement);
////////// End of temp solution /////////// The above comments out all the |
This issue is fixed by #4960 and webpack/webpack-dev-server#926 , right? @sokra @TheLarkInn |
@esbenp fixed for some messages. Still getting |
Would love this to get fixed. +1 |
Hey guys, none of these suggestions worked for me, except the CLI option does!!
It defaults to |
Maybe better fix this problem in |
Hey guys, @evilebottnawi Seems like this config is already handled in webpack-dev-server (https://github.com/webpack/webpack-dev-server/blob/34a4a26ccd8ea9f0349a9d3b257f686d43f027f8/client-src/default/index.js#L101). What do you think about adding an optional query string parameter to define the log level? This parameter would override the logLevel set by webpack-dev-server if defined. (Even tho this case should not really happen since webpack-dev-server is adding the hot dev server without any parameters). |
@webpack-bot move to webpack/webpack-dev-server |
I've moved it to webpack/webpack-dev-server. |
devServer: {
clientLogLevel: "silent", |
@agrublev this not working |
If you're using webpack-hot-middleware, you can configure it like this: webpack-hot-middleware/client?reload=true&noInfo=true |
Anyone using gatsby, you can alter webpack-hot-middleware configuration by adding the following to gatsby-node.js: exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
if (stage === 'develop') {
// First commons entry is webpack-hot-middleware
// @see https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/webpack.config.js
const commons = getConfig().entry.commons
commons[0] += '&noInfo=true'
actions.setWebpackConfig({
entry: {
commons,
},
})
}
} |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Right now webpack/hot/dev-server/ spams my console, especially with multiple hot entry points (double spam).
If the current behavior is a bug, please provide the steps to reproduce.
Use HMR in one of the entry points and check browser console.
What is the expected behavior?
Selective console logs in browser. Values:
none
,error
,warning
,info
.Webpack-dev-server has a devServer.clientLogLevel option, implemented here. The problem is,
webpack/hot/dev-server
should respect this option.Files doing the spam:
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
win10/ubuntu 1604, node v7.4.0, npm v4.0.5, webpack-, webpack-dev-server v2.2.0
The text was updated successfully, but these errors were encountered: