Skip to content

Commit

Permalink
remove comments before looking for goog.provide/require
Browse files Browse the repository at this point in the history
This is a workaround for the issue mxmul#16  "Incorrectly finds `goog.require` and `goog.provide` statements in comments"
  • Loading branch information
lexoyo authored Mar 23, 2019
1 parent c8e5521 commit 61339ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
.replace(/\/\*[^]*?\*\//g, '/* stripped comment */'); // block comments

let globalVars = [];
let exportedVars = [];

Expand Down

0 comments on commit 61339ba

Please sign in to comment.