Skip to content

Commit 498dc81

Browse files
committed
comment
1 parent 616d098 commit 498dc81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

injected/scripts/utils/comment-plugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export function commentPlugin({ pathMatch, regex }) {
4444

4545
/**
4646
* Detect the start of a particular comment and change the
47-
* lines to have the prefix `//!`
47+
* lines to have the prefix `//!` - this allows esbuild to keep it
4848
*
49-
* When a line is detect
49+
* When a line is matched, continue to match further lines until a non-comment is seen.
5050
*
5151
* @param {string} source
5252
* @param {RegExp} regex
@@ -58,11 +58,11 @@ export function convertToLegalComments(source, regex) {
5858

5959
for (const line of source.split('\n')) {
6060
if (insideCommentBlock) {
61-
if (!line.match(/^\/\//)) {
61+
if (!line.startsWith('//')) {
6262
insideCommentBlock = false;
6363
}
6464
} else {
65-
if (line.match(regex)) {
65+
if (line.startsWith('//') && line.match(regex)) {
6666
insideCommentBlock = true;
6767
}
6868
}

0 commit comments

Comments
 (0)