]> 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 16:32:13 +0000 (12:32 -0400)
build/tasks/build.js

index 1714957fa88f6d25795787d103d56320ba70cf2a..21779d80ac70839fed5812abc7cf8840be57ba10 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