Skip to content

Commit 7220214

Browse files
committed
module: remove require('.') with NODE_PATH compatibilty
1 parent cd60ff0 commit 7220214

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

lib/module.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ function tryExtensions(p, exts) {
125125
}
126126

127127

128-
const noopDeprecateRequireDot = util.deprecate(function() {},
129-
"warning: require('.') resolved outside the package directory. " +
130-
"This functionality is deprecated and will be removed soon.");
131-
132-
133128
Module._findPath = function(request, paths) {
134129
var exts = Object.keys(Module._extensions);
135130

@@ -174,8 +169,6 @@ Module._findPath = function(request, paths) {
174169
}
175170

176171
if (filename) {
177-
// Warn once if '.' resolved outside the module dir
178-
if (request === '.' && i > 0) noopDeprecateRequireDot();
179172
Module._pathCache[cacheKey] = filename;
180173
return filename;
181174
}
@@ -212,23 +205,13 @@ Module._resolveLookupPaths = function(request, parent) {
212205
}
213206

214207
var start = request.substring(0, 2);
215-
if (start !== './' && start !== '..') {
208+
if (start !== '.' && start !== './' && start !== '..') {
216209
var paths = modulePaths;
217210
if (parent) {
218211
if (!parent.paths) parent.paths = [];
219212
paths = parent.paths.concat(paths);
220213
}
221214

222-
// Maintain backwards compat with certain broken uses of require('.')
223-
// by putting the module's directory in front of the lookup paths.
224-
if (request === '.') {
225-
if (parent && parent.filename) {
226-
paths.splice(0, 0, path.dirname(parent.filename));
227-
} else {
228-
paths.splice(0, 0, path.resolve(request));
229-
}
230-
}
231-
232215
return [request, paths];
233216
}
234217

0 commit comments

Comments
 (0)