Closed colin273 closed 1 year ago
try webpack.getBySource("parseTwoDigitYear")
Searching by source is a last resort (and I mean LAST) for when the props or more reliable criteria aren't available, and in the case of moment.js they are very much available.
Will this be adding support for prototype of the function too?
Searching by prototype is out of scope for #450, since that PR is aimed at cleaning up and upgrading existing APIs rather than adding new ones. New webpack filters will need to be added in a separate PR.
Describe the bug
Currently, the webpack searcher only looks for props in objects, ignoring functions. This makes it needlessly verbose to search for modules such as moment.js (see #439), where useful props are on the top-level
moment()
function (the only export of its module) rather than an object.Reproduction steps
replugged.webpack.getByProps("isMoment")
replugged.webpack.getModule(m => typeof m.exports === "function" && m.exports.isMoment)
to get moment.jsExpected behavior
getByProps
should find moment.jsActual behavior
getByProps
returns undefinedAdditional information
Should be fixed soon-ish in the
webpack-sanity
branch, whenever that makes it to the PR stagePlease confirm the following