Change re2 into a peer dependency, such that users can choose to install re2 or not, depending on their situation.
Option 2
If the existence of url-regex-safe over url-regex means re2 must be kept in dependencies, at least change the actual code to allow fallback to plain RegExp, so webpack/esbuild users can mark re2 as external in build time until the issue above is fixed.
This originates from https://github.com/uhop/node-re2/issues/92, affecting builds via webpack and esbuild, browser or TypeScript for servers all alike.
Option 1
Change
re2
into a peer dependency, such that users can choose to installre2
or not, depending on their situation.Option 2
If the existence of
url-regex-safe
overurl-regex
meansre2
must be kept independencies
, at least change the actual code to allow fallback to plainRegExp
, so webpack/esbuild users can markre2
as external in build time until the issue above is fixed.