-
Notifications
You must be signed in to change notification settings - Fork 292
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
Update plugins to use Webpack Logger #202
Conversation
3ca6cbe
to
3b4b233
Compare
hey @GuilleAngulo is this good to go? saw some straggler commits, but noticed you removed the invalid tag |
Yeah, sorry about that @colbyfayock . What happened is that when I opened the PR the CI failed due to an unrecognized optional chaining. So while resolving it I wanted to mark it with some label to notify that it was in progress. I didnt know all label changes appear in the history...And I was testing which one I should use 🤓 . I think everything should work as expected but I'd love if you could test it also =) About commits, should I squash both into one to make the story clearer? |
hey sorry for the delay, About the visuals: So these things added to the fact that customizing debug is a bit tricky(since it can log other parts of next/webpack) make me think if it would be a good idea to close this issue for now. What do you think? Maybe I can try to improve the log that is already in the project (separating methods, using chalk, ...) About the config thing totally agree with you, doesnt seem like a correct way to solve it. I'll open a separate issue and try to figure out how can we fix it. |
thats strange, i would have thought it would be much more streamlined. yeah im cool with holding on it and tidying up manually if thats what you prefer. im cool with what you decide there |
I'm closing this for now, just because it seems that having our custom logger allows more freedom on how to output logs. Anyway I have all the information in case we need to get back to it. I think it is preferable to focus on the problem with the variables in plugins. |
Description
It updates plugins logging to use Webpack API. There are several methods available: it is possible to use
info()
,warn()
orerror()
for important messages andlog()
for messages only displayed when debug mode is enabled.Problem with plugins
While testing I realized there is a problem with the configuration: they all share the same config object. For example for the following config:
All plugins will create files at
./public/search
, because seems like the config object is passed sequentially from one plugin to the next. In order to fix this problem it is added a reset of the properties just after destructuring, to assure that the property will be undefined if nothing is passed. If a value is passed to other plugin it will override any previous value, so I think now is working as expected. Probably not the best approach/solution, but a quick fix for now, would love to hear your thoughs.Debug config
If a debug boolean variable is passed to the plugin config, additional logs will be displayed. Reference: https://webpack.js.org/configuration/other-options/#debug
Named plugins
For each plugin it is created a new class extending WebpackPluginCompiler class:
Just updated this part because I noticed that all plugins were pushed into webpack with same name, and maybe this could have some side effects at some point? Not sure of that, I can revert this change if you think its not necessary. (Reference: https://webpack.js.org/contribute/writing-a-plugin/#creating-a-plugin)
Would love if you could help me testing it and any thoughts you might have about it =)
Fixes #189