From ffafbc9d002e614c183f9027d2fdf485d929a9ff Mon Sep 17 00:00:00 2001 From: Austin Brunkhorst Date: Sat, 3 Jun 2017 19:31:29 -0700 Subject: [PATCH] fix(bundle): support quoteless script src attribute Fixes #639 Makes the capture groups optional for single/double quotes in the source file regular expression. --- lib/build/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/build/utils.js b/lib/build/utils.js index 22bc50374..b74c94e5e 100644 --- a/lib/build/utils.js +++ b/lib/build/utils.js @@ -63,11 +63,11 @@ exports.escapeForRegex = function(str) { exports.createSrcFileRegex = function() { let parts = Array.prototype.slice.call(arguments); - let regexString = "\\b(?:src=(\"|')(.*))("; + let regexString = "\\b(?:src=(\"|')?(.*))("; for (let i = 0; i < parts.length; i ++) { regexString = regexString + exports.escapeForRegex(parts[i]) + (i < (parts.length - 1) ? '(\/|\\\\)' : ''); } - regexString = regexString + "(.*?).js)(?:(\"|'))"; + regexString = regexString + "(.*?).js)(?:(\"|')?)"; return new RegExp(regexString); };