You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is an exception when loading a user resolver then the exception is not reported. For example, if there is a syntax error in a user resolver or if the user has a bad import then the exception is swallowed.
It is much safer to use code that checks for the existence of a module using require.resolve():
functiontryRequire(target){letresolved;try{// Check if the target existsresolved=require.resolve(target);}catch(e){// If the target does not exist then just return undefinedreturnundefined;}// If the target exists then return the loaded modulereturnrequire(resolved);}
I will be submitting a PR.
The text was updated successfully, but these errors were encountered:
If there is an exception when loading a user resolver then the exception is not reported. For example, if there is a syntax error in a user resolver or if the user has a bad import then the exception is swallowed.
This problem is because of the
try...catch
around therequire()
calls: https://github.com/benmosher/eslint-plugin-import/blob/master/utils/resolve.js#L140-L155It is much safer to use code that checks for the existence of a module using
require.resolve()
:I will be submitting a PR.
The text was updated successfully, but these errors were encountered: