Skip to content

Commit 789a6cf

Browse files
committed
fix start as well as end with ','
1 parent ec15c4b commit 789a6cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
161161
.replace(regExp2replace2GetVar, "")
162162
.replace(regExp2replace2GetVar0, "");
163163
for (let index = 1; index < jsxMatches.length; index++) {
164-
txt = txt.replace(jsxMatches[index], "");
164+
const token = jsxMatches[index];
165+
const toReplace = token.match(/^,.*,$/) ? token.slice(1) : token;
166+
txt = txt.replace(toReplace, "");
165167
const v1 = jsxMatches[index]
166168
.replace(regExp2replace2GetVar, "")
167169
.replace(regExp2replace2GetVar0, "");

0 commit comments

Comments
 (0)