mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
fix(build): tree-shake React reconciler dev build to prevent PerformanceMeasure leak (#4462)
The ink 6→7 upgrade (v0.15.11) pulled in react-reconciler 0.33, whose development build calls performance.measure() on every component render. Since NODE_ENV was never set to "production" in the esbuild define map, the bundle shipped both dev and prod builds and selected dev at runtime, causing an unbounded measureEntryBuffer leak (~45% of heap after moderate use, confirmed via heap snapshots). Set process.env.NODE_ENV to "production" at build time so esbuild statically resolves the conditional require and tree-shakes the entire 15k-line dev build. Bundle shrinks by ~700 KB / 15,800 lines.
This commit is contained in:
parent
0cb9ff0a23
commit
61d91ad716
1 changed files with 5 additions and 0 deletions
|
|
@ -112,6 +112,11 @@ esbuild
|
|||
},
|
||||
define: {
|
||||
'process.env.CLI_VERSION': JSON.stringify(pkg.version),
|
||||
// react-reconciler ≥0.33 (ink 7) gates its dev build behind NODE_ENV
|
||||
// and calls performance.measure() on every render, leaking
|
||||
// PerformanceMeasure objects into the global measureEntryBuffer.
|
||||
// Setting production here tree-shakes the entire dev build (~15k lines).
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
// Make global available for compatibility
|
||||
global: 'globalThis',
|
||||
// Redirect free __dirname/__filename references to the shim so that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue