Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixing broken require: require('util') -> require('../utils') #395
In the file
This likely fell through the cracks because the only place this file is required in the code, it's wrapped in a
It's worth noting that this was causing my project to break when using webpack, as webpack tries to go in and follow all the require statements and bundle everything up, but it would hit this and break.
So apparently my webpack configuration was accidentally overwriting Node's util with our own 'util' alias and that was mucking up the works. I changed that and everything works hunky-dory.
Having said that though, I would still recommend merging this PR for the following reason:
This module also has the
You can compare the code here:
Admittedly, it's a minor issue, and the code works the same regardless, but three cheers for code consistency? :)
What do you think of it ?
I think if you fear edge cases where your implementations differ then you should use Node's
If you decide that your implementation is good enough for your use cases, then use your home rolled version everywhere.
Personally, your home rolled version is quite simple, and if something big changes, I don't imagine it will be as hard to debug as you imagine, and you could always switch over later. I think it's not particularly a big deal either way, but I think you should use 1 or the other throughout your codebase for consistencies sake.