Skip to content

Commit ddca646

Browse files
committed
Fix: Avoid regexp creating havoc when no empty chunks found.
1 parent d95e0b6 commit ddca646

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

esbuild-plugin-react18/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ function onEndCallBack(result: BuildResult, options: React18PluginOptions, write
120120
.map(f => f.path.split(path.sep).pop());
121121

122122
const emptyChunkImportRegExp = new RegExp(
123-
`import *"[^"]*(${emptyChunkFiles?.join("|")})";[\n\r ]*`,
123+
`import *"[^"]*(${emptyChunkFiles?.join("|") || "--no-empty-chunks--"})";[\n\r ]*`,
124124
"g",
125125
);
126+
126127
/** fix use client and use server*/
127128
result.outputFiles
128129
?.filter(f => !f.path.endsWith(".map"))

0 commit comments

Comments
 (0)