circular reference cause `inherits()` became empty object

Open Beginner friendly
#80 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, nodejs
Domain
backend

Research direction

Start at util.js line 592, linked in the issue, and inspect the circular require involving inherits and util. Update the referenced module path as specified, then verify that requiring util and calling util.inherits no longer encounters an empty export during initialization.

Written by the indexing model from the issue text.

Description

the line below refs to inherits() from inherits module, but inherits module reference back to util module by checking the implementation on util module first, causing the first require('inherits') to returns empty object (default exports is empty object), if then util.inherits() gets call immediately it will throw.

problematic line in question:
https://github.com/browserify/node-util/blame/ef984721db7150f651800e051de4314c9517d42c/util.js#L592

the line needs to be updated to require('inherits/inherits_browser')

Dominant language
JavaScript
Stars
255
Forks
93
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browserify/node-util

All issues in browserify/node-util

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.