question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module.require isn't present

See original GitHub issue

In node.js, module.require is the basis for the require function. Browserify instead directly hands the require function over, without exposing any functionality as module.require.

I’m trying to browserify a module that uses defaultable, which heavily depends on the behavior of node.

It would be awesome if module.require could be at least a reference to the require function.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
jhscommented, Sep 5, 2013

@substack, would it be possible for this to be optional or even un-documented?

We might argue about what constitutes “hacky overriding.” What I know is that we are using @fb55’s code in production and it works well. I agree with your point about spending bytes in every bundle; but I also agree with Felix’s point that supporting a documented (stability = 5, locked) feature would be nice.

We will be okay either way, just asking you to reconsider. Thanks.

1reaction
ghostcommented, Aug 21, 2013

I’m not convinced that this feature is worth supporting since it would only enable hacky overriding that probably shouldn’t be done in the first place at the expense of extra bytes in every browserify bundle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found error in node.js - Stack Overflow
Use: require('./utils.js'); . This is the correct way to require a module from a file which is located in required module's folder.
Read more >
Fix "require is not defined" in JavaScript/Node - Stack Abuse
The require method is not available in the browser. To solve this, you have a few options, a few of which we'll briefly...
Read more >
How to fix "require is not defined" in JavaScript / Node.js?
Learn what is "require-is-not-defined" error in JavaScript, when they occur, and how you can fix it in both browser and Node.js environment.
Read more >
How to fix the error `require is not defined` in Node.js
Today I started writing a new project on Node.js and got this error on the very first run: const express = require('express'); ...
Read more >
How To Fix ReferenceError require is not defined in JavaScript
In this case, check your package.json file for an property called type . If that is set to module , ES6 modules will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found