File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ export function commentPlugin({ pathMatch, regex }) {
44
44
45
45
/**
46
46
* 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
48
48
*
49
- * When a line is detect
49
+ * When a line is matched, continue to match further lines until a non-comment is seen.
50
50
*
51
51
* @param {string } source
52
52
* @param {RegExp } regex
@@ -58,11 +58,11 @@ export function convertToLegalComments(source, regex) {
58
58
59
59
for ( const line of source . split ( '\n' ) ) {
60
60
if ( insideCommentBlock ) {
61
- if ( ! line . match ( / ^ \/ \/ / ) ) {
61
+ if ( ! line . startsWith ( '//' ) ) {
62
62
insideCommentBlock = false ;
63
63
}
64
64
} else {
65
- if ( line . match ( regex ) ) {
65
+ if ( line . startsWith ( '//' ) && line . match ( regex ) ) {
66
66
insideCommentBlock = true ;
67
67
}
68
68
}
You can’t perform that action at this time.
0 commit comments