It is said that require.resolve will not load the module specified in the parameter, but why does a module that does not exist in require.resolve report an error of Cannot find module ‘xxx’? Arguably, he only needs to query the file name of the complete absolute path of a certain Module file, and it is good to do so. Don’t you care if the module exists? Not wrong, right? Seek advice from the great god
require.resolveThe return value (module path) is required. No Error is found under normal logic. Is it returned
Reference source code:
All right, Slapping, the inside did return null, only nodejs wrapped a layer and created an Error throw.
PS: It is said that nodejs writes some codes at random ~ ~ ~