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
While inspecting my bundle output I just saw that an unreferenced regex wasn't removed by DCE.
It looks like it only affects regex created by new RegExp(...).
Is there a reason for that ?
const regex1 = new RegExp('foo'); // KO
const regex2 = /foo/ // OK
This is because esbuild considers throwing an exception to be a side effect, and new RegExp can potentially throw an exception (such as new RegExp('[')). The string literal is not checked for whether it's a valid regular expression or not.
While inspecting my bundle output I just saw that an unreferenced regex wasn't removed by DCE.
It looks like it only affects regex created by
new RegExp(...)
.Is there a reason for that ?
Demo
The text was updated successfully, but these errors were encountered: