Skip to content
This repository was archived by the owner on Jan 6, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function StripFnLoader(source) {

var toStrip = query.strip.join('|');

var regexPattern = new RegExp('\\n[ \\t]*(' + toStrip + ')\\([^\\);]+\\)[ \\t]*[;\\n]', 'g');
var regexPattern = new RegExp('\\n[ \\t]*(' + toStrip + ').*', 'g');

var transformed = source.replace(regexPattern, '\n');

Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
*/

var makeFoo = function (bar, baz) {
// The following 2 lines of code will be stripped with our webpack loader
// The following 3 lines of code will be stripped with our webpack loader
console.log('some debug info');
debug('better debug info');
debug('even better %s' + (true), 'debug info');
// This code would remain
debugger;
return new Foo(bar, baz);
};
4 changes: 2 additions & 2 deletions tests/unit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ var createWebpackTest = function (done) {

var originalSource = fs.readFileSync(cwd + '/index.js', {encoding: 'utf8'});
expect(originalSource).to.contain('console.log');
expect(originalSource).to.contain('debug');
expect(originalSource).to.contain('debug(');

var strippedSource = statsJson.modules[0].source;
expect(strippedSource).to.not.contain('console.log');
expect(strippedSource).to.not.contain('debug');
expect(strippedSource).to.not.contain('debug(');

done(err);
};
Expand Down