-
Notifications
You must be signed in to change notification settings - Fork 214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
console.error(err.stack || err); | ||
err.details && console.error(err.details); | ||
}); | ||
errors.forEach(err => console.error(err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.forEach(console.error);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem is, forEach passes currentValue, index, array
... We only want to log currentValue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, always forget that. You can solve that by brining in unary
from ramda and putting console.error in it:
const { unary } = require('ramda');
errors.forEach(unary(console.error));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or if you prefer, put a logError
or something in utils that has the same thing.
const logError = unary(console.error);
module.exports = {
// ...
logError,
// ...
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rambda stuff seems not worth it in many cases IMO, adds an extra layer of indirection, making it harder to reason about if you're not familiar with them all. Some might be more obvious but if I saw unary()
I'd just be like huh wtf is that if you're not familiar with the package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that just slapping unary()
right in the forEach
probably isn't very descriptive, but putting it in utils with a comment should be OK. In fact, adding comments to all our utility functions would be a good thing. ™
err.details && console.error(err.details); | ||
}); | ||
|
||
errors.forEach(err => console.error(err)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.forEach(console.error);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem is, forEach passes currentValue, index, array... We only want to log currentValue.
What will this do for exceptions that aren't bubbled from webpack, e.g. can't find a package? |
By default, In short, errors not bubbled from webpack should work just fine. |
@jaridmargolin any idea if this had shipped in Webpack yet? |
Merged but not shipped. |
Looks like Webpack 2.4.1 is out and I think it has your changes. |
47352ce
to
a78b3cc
Compare
Rebased and bumped webpack version to 2.4.1. I did not make any changes to the forEach block discussed above. I think the current implementation |
Codecov Report
@@ Coverage Diff @@
## master #148 +/- ##
=======================================
Coverage 94.14% 94.14%
=======================================
Files 36 36
Lines 512 512
=======================================
Hits 482 482
Misses 30 30 Continue to review full report at Codecov.
|
Looks like all the webpack versions were changed by modifying the version number in package.json, but this won't update what we keep locked in yarn. If you want to upgrade a package from the root, use: yarn upgrade webpack
yarn deps:upgrade neutrino webpack
yarn deps:upgrade neutrino-middleware-chunk
# etc... This will update package.json and yarn.lock files too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the relevant commands to update the yarn.lock files:
yarn upgrade webpack
yarn deps:upgrade neutrino-middleware-banner webpack
...
a78b3cc
to
adbc0cc
Compare
yarnified 👍 |
Looks like there's a merge conflict, could you rebase? |
adbc0cc
to
95e8670
Compare
Released in v5.7.0. |
PENDING webpack/webpack#4568. Will also need to bump webpack version across packages.