Skip to content

Commit 261fbd3

Browse files
committed
Do not remove ';' when require statement starts with ','.
1 parent c62056b commit 261fbd3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
168168
for (let index = 1; index < jsxMatches.length; index++) {
169169
let token = jsxMatches[index];
170170
if (/^,.*,$/.test(token)) token = token.slice(1);
171-
else if (token.startsWith("var ") && token.endsWith(",")) token = token.slice(4);
171+
else if (/^,.*;$/.test(token)) token = token.replace(";", "");
172+
else if (/^var .*,$/.test(token)) token = token.slice(4);
172173
txt = txt.replace(token, "");
173174
const v1 = jsxMatches[index]
174175
.replace(regExp2replace2GetVar, "")

0 commit comments

Comments
 (0)