From 6bf6ce1df613618395145e7c96e7b4df08af18d6 Mon Sep 17 00:00:00 2001 From: Alex Hoyau Date: Fri, 22 Mar 2019 20:39:47 -0600 Subject: [PATCH] Do not look for goog.provide/require in comments This is a workaround for the issue #16 "Incorrectly finds `goog.require` and `goog.provide` statements in comments" --- lib/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 2fc0b62..1ee7a8b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -205,7 +205,10 @@ function createPrefix(loaderContext, globalVarTree, globalVars, useEval) { module.exports = function loader(originalSource, inputSourceMap) { const self = this; const callback = this.async(); - let source = originalSource; + let source = originalSource + //.replace(/\/\/.*/g, '') // remove line comments (somehow this bugs) + .replace(/\/\*[^]*?\*\//g, '/* stripped comment */'); // block comments + let globalVars = []; let exportedVars = [];