Skip to content

Commit

Permalink
fix for comments right before requires
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed May 4, 2016
1 parent 4bbfdcf commit 6fb3344
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cjs.js
Expand Up @@ -38,7 +38,7 @@
while (match = commentRegEx.exec(source)) {
// only track comments not starting in strings
if (!inLocation(stringLocations, match))
commentLocations.push([match.index, match.index + match[0].length]);
commentLocations.push([match.index + match[1].length, match.index + match[0].length - 1]);
}
}

Expand Down
5 changes: 3 additions & 2 deletions test/tests/commonjs-requires.js
@@ -1,3 +1,6 @@
exports.d6 =
/**/require('./commonjs-d2.js');

exports.d1 = require(
'./commonjs-d.js'
);
Expand All @@ -15,8 +18,6 @@ exports.d5 = 'text \'quote\' require("yet still not a dep")';

var regexWithString = /asdfasdf " /;

exports.d6 = require('./commonjs-d2.js');

var regexClose = /asdf " */;

// This comment triggered SystemJS to do a require because of this -> require('')
Expand Down

0 comments on commit 6fb3344

Please sign in to comment.