From 03eb106a789635d4acbb78d56a3681025b3a4743 Mon Sep 17 00:00:00 2001 From: Marcus Zanona Date: Fri, 3 Nov 2017 18:14:02 -0200 Subject: [PATCH] fix(parser/js): hasImports discovery for modules without extension --- parser/js.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser/js.js b/parser/js.js index 600690f..a2a9c19 100644 --- a/parser/js.js +++ b/parser/js.js @@ -3,11 +3,11 @@ exports.setContent = function (content, file) { * replace require or import statements module names ending with * .js or .json so these won't get renamed by the general parser */ - const requireMatch = /require\((['"])(.*?)\.(?:js|json)\1\)/gm, - importMatch = /import((?:.*?from)? +)(["'])(.+?)\.(?:js|json)\2/gm; + const requireMatch = /require\((['"])(.*?)(?:\.js|\.json)?\1\)/gm, + importMatch = /import((?:.*?from)? +)(["'])(.+?)(?:\.js|\.json)?\2/gm; if (requireMatch.test(content) || importMatch.test(content)) { - file.hasImports = true; + file.hasImports = true; } return content.replace(requireMatch, 'require($1$2$1)')