]> source.dussan.org Git - jquery.git/commitdiff
Don't keep semicolons if the require call is not a var declaration
authorTimmy Willison <timmywillisn@gmail.com>
Mon, 9 Sep 2013 16:32:06 +0000 (12:32 -0400)
committerTimmy Willison <timmywillisn@gmail.com>
Mon, 9 Sep 2013 18:55:07 +0000 (13:55 -0500)
build/tasks/build.js

index d8cea4c52f0dfa70c4659d573218d168ec8558ff..cf5fc9b6fc46543a7e6a8842091b75debbbc834e 100644 (file)
@@ -68,9 +68,9 @@ module.exports = function( grunt ) {
                        // Remove CommonJS-style require calls
                        // Keep an ending semicolon
                        contents = contents
-                               .replace( /(?:\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\1\s*\)([,;])/g,
-                                       function( all, quote, commaSemicolon ) {
-                                               return commaSemicolon === ";" ? ";" : "";
+                               .replace( /(\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\2\s*\)([,;])/g,
+                                       function( all, isVar, quote, commaSemicolon ) {
+                                               return isVar && commaSemicolon === ";" ? ";" : "";
                                        });
 
                        // Remove empty definitions