Skip to content

Commit 02619be

Browse files
authored
Merge pull request #17 from react18-tools/fix-esm-on-unminified-builds
Fix esm build for non minified versions
2 parents d0f43dc + fe4af04 commit 02619be

File tree

2 files changed

+5
-2
lines changed
  • esbuild-plugin-react18/src
  • packages/esbuild-plugin-react18-example/src

2 files changed

+5
-2
lines changed

esbuild-plugin-react18/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
119119
?.filter(f => f.text.trim() === "" && f.path.includes("chunk"))
120120
.map(f => f.path.split(path.sep).pop());
121121

122-
const emptyChunkImportRegExp = new RegExp(`import"[^"]*(${emptyChunkFiles?.join("|")})";`, "g");
122+
const emptyChunkImportRegExp = new RegExp(
123+
`import *"[^"]*(${emptyChunkFiles?.join("|")})";[\n\r ]*`,
124+
"g",
125+
);
123126
/** fix use client and use server*/
124127
result.outputFiles
125128
?.filter(f => !f.path.endsWith(".map"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"use client";
22

33
/** to make sure import statements remain same for monorepo setup and install via npm */
4-
export * from "./src/client";
4+
export * from "./client";

0 commit comments

Comments
 (0)