Skip to content

Commit

Permalink
Merge pull request #27 from react18-tools/fix-jsx-dedup
Browse files Browse the repository at this point in the history
Fix-jsx-dedup
  • Loading branch information
mayank1513 authored Jun 2, 2024
2 parents c62056b + 97ccace commit 328042d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# esbuild-plugin-react18

## 0.2.4

### Patch Changes

- Do not remove ';' when require statement starts with ','.

## 0.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "esbuild-plugin-react18",
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
"private": false,
"version": "0.2.3",
"version": "0.2.4",
"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).",
"license": "MPL-2.0",
"main": "./dist/index.js",
Expand Down
3 changes: 2 additions & 1 deletion lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
for (let index = 1; index < jsxMatches.length; index++) {
let token = jsxMatches[index];
if (/^,.*,$/.test(token)) token = token.slice(1);
else if (token.startsWith("var ") && token.endsWith(",")) token = token.slice(4);
else if (/^,.*;$/.test(token)) token = token.replace(";", "");
else if (/^var .*,$/.test(token)) token = token.slice(4);
txt = txt.replace(token, "");
const v1 = jsxMatches[index]
.replace(regExp2replace2GetVar, "")
Expand Down

0 comments on commit 328042d

Please sign in to comment.