Skip to content

Commit 328042d

Browse files
authored
Merge pull request #27 from react18-tools/fix-jsx-dedup
Fix-jsx-dedup
2 parents c62056b + 97ccace commit 328042d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# esbuild-plugin-react18
22

3+
## 0.2.4
4+
5+
### Patch Changes
6+
7+
- Do not remove ';' when require statement starts with ','.
8+
39
## 0.2.3
410

511
### Patch Changes

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "esbuild-plugin-react18",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "0.2.3",
5+
"version": "0.2.4",
66
"description": "Unlock the Potential of React Server Components! Harness the power of an ESBuild plugin designed for crafting libraries compatible with RSC (React18 Server Components).",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",

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)