Add null check to avoid TypeError: Cannot read properties of undefined (reading 'call')
#18021
Labels
TypeError: Cannot read properties of undefined (reading 'call')
#18021
Feature request
Note that this is not a bug report, this is a UX improvement ticket. It won't actually solve the underlying issue but it might help webpack users understand it better.
What is the expected behavior?
Occasionally webpack fails to properly load modules and it fails on this line, causing:
And others like it: https://github.com/webpack/webpack/issues?q=is:issue+sort%253Aupdated-desc+%2522Cannot+read+properties+of+undefined%2522+in%253Atitle+is%253Aclosed++call
What is motivation or use case for adding/changing the behavior?
The error is in webpack's own code and it's far removed from the cause.
How should this be implemented in your opinion?
Catching the error and rewording it will help people find a solution.
A better error would look like this, including as much information as possible regarding its context
"The module
sugar/free.js
could not be loaded from './wood-cake.js' etc"Are you willing to work on this yourself?
If the fix looks like this yes:
The text was updated successfully, but these errors were encountered: