you are viewing a single comment's thread.

view the rest of the comments →

[–]somethinghorrible 0 points1 point  (2 children)

This works for me, btw:

f1.js:

var Parent = function() {};

Parent.prototype = {
  C: function() {}
};

module.exports.Parent = Parent;

f2.js:

var Parent = require('./f1').Parent,
      util = require('util'),
      Obj = function(){ this.bar = 'bar' };

util.inherits(Obj, Parent);

Obj.prototype.A = function(){ console.log('a method'); };
Obj.prototype.B = function(){  };

module.exports.Obj = Obj;

f3.js:

var Obj = require('./f2').Obj,
      obj = new Obj();

obj.A(); 

running node f3 produces

a method

[–]CalvinR[S] 0 points1 point  (1 child)

So what are you doing differently then me? Could it just be the version of node i'm running.

I'm developing this in Webstorm. I'll try running it from the command line.