module: fix $ pattern replacements
This fixes the bug where import 'pkg/$$.js'
will resolve to pkg/$.js
when using the exports pattern *.js -> *.js
, due to the JS String replace DSL footgun (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter).
Thanks to @Rich-Harris for sharing this one on Twitter - https://twitter.com/Rich_Harris/status/1435703344354451458.
@nodejs/modules