Skip to content

Commit

Permalink
module: remove unnecessary property and method
Browse files Browse the repository at this point in the history
`require.paths` property and `require.registerExtension` function have
been throwing errors when used. They both are like this for years now.
This patch removes them from the system.

PR-URL: #2922
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
thefourtheye committed Oct 6, 2015
1 parent 8853388 commit 6ad458b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,20 +389,10 @@ Module.prototype._compile = function(content, filename) {
return Module._resolveFilename(request, self);
};

Object.defineProperty(require, 'paths', { get: function() {
throw new Error('require.paths is removed. Use ' +
'node_modules folders, or the NODE_PATH ' +
'environment variable instead.');
}});

require.main = process.mainModule;

// Enable support to add extra extension types
require.extensions = Module._extensions;
require.registerExtension = function() {
throw new Error('require.registerExtension() removed. Use ' +
'require.extensions instead.');
};

require.cache = Module._cache;

Expand Down
4 changes: 0 additions & 4 deletions test/sequential/test-module-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ assert.equal(require('../fixtures/registerExt2').custom, 'passed');
assert.equal(require('../fixtures/foo').foo, 'ok',
'require module with no extension');

assert.throws(function() {
require.paths;
}, /removed/, 'Accessing require.paths should throw.');

// Should not attempt to load a directory
try {
require('../fixtures/empty');
Expand Down

0 comments on commit 6ad458b

Please sign in to comment.