diff --git a/lib/index.js b/lib/index.js index 9b6f111..3c70657 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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'); diff --git a/tests/fixtures/app/index.js b/tests/fixtures/app/index.js index 87a1ef3..4cbdd93 100644 --- a/tests/fixtures/app/index.js +++ b/tests/fixtures/app/index.js @@ -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); }; diff --git a/tests/unit/index.js b/tests/unit/index.js index 74578c3..2984add 100644 --- a/tests/unit/index.js +++ b/tests/unit/index.js @@ -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); };