diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index 5b22ec02..bdd84843 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -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 diff --git a/lib/package.json b/lib/package.json index 94897a66..9fb79479 100644 --- a/lib/package.json +++ b/lib/package.json @@ -2,7 +2,7 @@ "name": "esbuild-plugin-react18", "author": "Mayank Kumar Chaudhari ", "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", diff --git a/lib/src/index.ts b/lib/src/index.ts index 5cc1768b..a84cd1fa 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -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, "")