Skip to content

Commit 14fee73

Browse files
davidaureliofacebook-github-bot
authored andcommitted
Use verbose module name when requiring module that errored
Summary: When requiring a module that has previously errored, the implementation of `require` only used the numerical module ID. In this diff, we enable usage of the verbose module name if present. Reviewed By: bestander Differential Revision: D4737723 fbshipit-source-id: 1c2d3906435a637f3e440e57f904489d84495bd2
1 parent 68c7739 commit 14fee73

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packager/src/Resolver/polyfills/require.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ function unknownModuleError(id) {
202202
}
203203

204204
function moduleThrewError(id) {
205-
return Error('Requiring module "' + id + '", which threw an exception.');
205+
const displayName = __DEV__ && modules[id] && modules[id].verboseName || id;
206+
return Error('Requiring module "' + displayName + '", which threw an exception.');
206207
}
207208

208209
if (__DEV__) {

0 commit comments

Comments
 (0)