You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All valid Terser options are supported. For this reproduction, the Terser nth_identifier option works.
Actual Behavior
An exception during build because only some of the code for the nth_identifier option is serialized. Other things seem to break from serializing the options, like nameCache updates.
Additional Information
The offending line that shows up in stack traces is here:
But, the technique of taking options in one realm and serializing them to another, like a worker, is just not generally workable. Not all Terser options will be serializable. Functions are an obvious case, but I've had other cases of objects with prototypes, etc., breaking too.
The text was updated successfully, but these errors were encountered:
justinfagnani
changed the title
[plugin-terser] The worker approach to running Terse breaks many valid Terser options
[plugin-terser] The worker approach to running Terser breaks many valid Terser options
Oct 3, 2024
Basically, nameCache is supported. However, the issue lies in the parallel worker execution.
On each successful terser execution, the nameCache output gets merged into the central cache object.
The problem arises when the same name appears on multiple files that are being processed in parallel. Each mangles independently, sending out conflicting output cache.
Expected Behavior
All valid Terser options are supported. For this reproduction, the Terser
nth_identifier
option works.Actual Behavior
An exception during build because only some of the code for the
nth_identifier
option is serialized. Other things seem to break from serializing the options, likenameCache
updates.Additional Information
The offending line that shows up in stack traces is here:
plugins/packages/terser/src/worker.ts
Line 39 in 4a2358a
But, the technique of taking options in one realm and serializing them to another, like a worker, is just not generally workable. Not all Terser options will be serializable. Functions are an obvious case, but I've had other cases of objects with prototypes, etc., breaking too.
The text was updated successfully, but these errors were encountered: