diff --git a/lib/utils.js b/lib/utils.js index d6faf6dfd8..86ba8f0376 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -528,8 +528,10 @@ exports.canonicalize = function canonicalize(value, stack, typeHint) { * hasMatchingExtname('foo.html', ['js', 'css']); // => false */ function hasMatchingExtname(pathname, exts) { - var re = new RegExp('\\.(?:' + exts.join('|') + ')$'); - return re.test(path.extname(pathname)); + var suffix = path.extname(pathname).slice(1); + return exts.some(function(element) { + return suffix === element; + }); } /**