Skip to content

Commit 6ad458b

Browse files
committed
module: remove unnecessary property and method
`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 <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 8853388 commit 6ad458b

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

lib/module.js

-10
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,10 @@ Module.prototype._compile = function(content, filename) {
389389
return Module._resolveFilename(request, self);
390390
};
391391

392-
Object.defineProperty(require, 'paths', { get: function() {
393-
throw new Error('require.paths is removed. Use ' +
394-
'node_modules folders, or the NODE_PATH ' +
395-
'environment variable instead.');
396-
}});
397-
398392
require.main = process.mainModule;
399393

400394
// Enable support to add extra extension types
401395
require.extensions = Module._extensions;
402-
require.registerExtension = function() {
403-
throw new Error('require.registerExtension() removed. Use ' +
404-
'require.extensions instead.');
405-
};
406396

407397
require.cache = Module._cache;
408398

test/sequential/test-module-loading.js

-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ assert.equal(require('../fixtures/registerExt2').custom, 'passed');
127127
assert.equal(require('../fixtures/foo').foo, 'ok',
128128
'require module with no extension');
129129

130-
assert.throws(function() {
131-
require.paths;
132-
}, /removed/, 'Accessing require.paths should throw.');
133-
134130
// Should not attempt to load a directory
135131
try {
136132
require('../fixtures/empty');

0 commit comments

Comments
 (0)