rollup-plugin-re
rollup-plugin-re copied to clipboard
Inconsistent arguments passed to pattern.replace function
When test is a Regex and the pattern.replace is a function, the match array is passed to pattern.replace
When test is a string, the file id is passed to pattern.replace
The former makes sense but not sure about the usefulness of the later.
The former makes sense but not sure about the usefulness of the later.
i find that it's useful to get the id in both cases. for instance if i want to replace require("([\w/.-]+).json")
with the contents of that file, i need to resolve the path relative to the module id path.
consistency is good, and IMO the id should be the first arg in both cases followed by matches.
ping @jetiny ?