Skip to content

Commit

Permalink
Merge pull request #17 from react18-tools/fix-esm-on-unminified-builds
Browse files Browse the repository at this point in the history
Fix esm build for non minified versions
  • Loading branch information
mayank1513 authored Apr 27, 2024
2 parents d0f43dc + fe4af04 commit 02619be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion esbuild-plugin-react18/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
?.filter(f => f.text.trim() === "" && f.path.includes("chunk"))
.map(f => f.path.split(path.sep).pop());

const emptyChunkImportRegExp = new RegExp(`import"[^"]*(${emptyChunkFiles?.join("|")})";`, "g");
const emptyChunkImportRegExp = new RegExp(
`import *"[^"]*(${emptyChunkFiles?.join("|")})";[\n\r ]*`,
"g",
);
/** fix use client and use server*/
result.outputFiles
?.filter(f => !f.path.endsWith(".map"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client";

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

0 comments on commit 02619be

Please sign in to comment.