Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Do not look for goog.provide/require in comments #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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 (somehow this bugs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this would strip everything in the source file after the first comment. You probably only want to match until EOL.

.replace(/\/\*[^]*?\*\//g, '/* stripped comment */'); // block comments
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is [^]* equivalent to .*? More readable as the latter if so

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
I just took people comments and made a PR. I was not even sure that you would answer. Now that I know I will take the time to understand and fix everything :)
Thank you for your feedback


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

Expand Down